Use fopen(), fread(), and fclose() to open, read, and close a file


SUBMITTED BY: henry1874w

DATE: June 17, 2017, 1:38 p.m.

FORMAT: Text only

SIZE: 209 Bytes

HITS: 288

  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4. <?php
  5. $myfile = fopen("webdictionary.txt", "r") or die("Unable to open file!");
  6. echo fread($myfile,filesize("webdictionary.txt"));
  7. fclose($myfile);
  8. ?>
  9. </body>
  10. </html>

comments powered by Disqus