php File Managment:
Alright i am back after a long time so ... my new topic from today file management , no doubt its play an important role for any programming language its also important for php as well.so i am starting from basic for file management operations.
we need to open a file,read a file ,do some modifications in files, i will discuss today how to read files in php.
Example:
<?php
//
read files from my destination
$file
= 'destination/phpguidefile.txt' or
die('file not Found');
//
to open file we use fopen
$fh
=
fopen($file, 'r') or die('file unable to open');
// to read file data/text use fread
$content =
fread($fh,
filesize($file)) or die('Reading Error');
//
also its important to close file use fclose
fclose
($fh);
//
Echo text/data from file in php script
echo
$content;
?>