Reading from a File : File Read « File Directory « PHP






Reading from a File


 <?php
  $myfile = "./test.txt";

  $openfile = fopen ($myfile, "r") or die ("Couldn't open the file");
  $file_size=filesize($myfile);

  $file_content = fread ($openfile, $file_size);
  fclose ($openfile);

  echo $file_content;
  ?>
           
       








Related examples in the same category

1.Reading a Specific Character
2.Using fgets() and feof() Functions
3.Reading Specific Data from a File
4.Opening and Reading a File Line by Line
5.Reading a File with fread()
6.File read by char