Mega Code Archive

 
Categories / Php / File Directory
 

Fread() function reads up to length bytes from the file, returning the files contents

Its syntax is: string fread (int filepointer, int length) Reading stops either when length bytes have been read or when the end of the file has been reached.  <?     $fh = fopen('data.txt', "r") or die("Can't open file!");     $file = fread($fh, filesize($fh));     print $file;     fclose($fh); ?>