PHP – read text file and get contents

<?php

$myfile = fopen("file-to-read.txt", "r") or die("Unable to open file!");
// Output one line until end-of-file
while(!feof($myfile))
  {
    echo fgets($myfile) . "<br>";
  }
fclose($myfile);

?>
It's only fair to share...Tweet about this on TwitterShare on FacebookEmail this to someoneShare on Google+
This entry was posted in PHP/MySQL and tagged , . Bookmark the permalink.