/fileIO/fOpen.php

https://bitbucket.org/davidjmcclelland/ph_sourcelibdir · PHP · 20 lines · 11 code · 0 blank · 9 comment · 1 complexity · f41996ff9b51b1dd635c1c865adbd1e6 MD5 · raw file

  1. <?php
  2. /*
  3. * modes: r, w, a, r+, w+, a+, x+:
  4. * r: read from start(file must exist),
  5. * w: truncate/write from start,
  6. * a: append/write from end,
  7. * x: write from start (file can't exist)
  8. * add "+" after each to make read mode
  9. *
  10. */
  11. $file = 'filetext.txt';
  12. if($handle = fopen($file, 'w'))
  13. {
  14. fclose($handle);
  15. }
  16. else
  17. {
  18. echo "<p>Could not open file or writing</p>";
  19. }
  20. ?>