fopen_variation6.phpt 756 B

123456789101112131415161718192021222324252627282930313233343536
  1. --TEST--
  2. Test fopen() function : variation: use include path and stream context relative/absolute file
  3. --CREDITS--
  4. Dave Kelsey <d_kelsey@uk.ibm.com>
  5. --FILE--
  6. <?php
  7. echo "*** Testing fopen() : variation ***\n";
  8. $absfile = __FILE__.'.tmp';
  9. $relfile = "fopen_variation6.tmp";
  10. $h = fopen($absfile, "w");
  11. fwrite($h, "This is an absolute file");
  12. fclose($h);
  13. $h = fopen($relfile, "w");
  14. fwrite($h, "This is a relative file");
  15. fclose($h);
  16. $ctx = stream_context_create();
  17. $h = fopen($absfile, "r", true, $ctx);
  18. fpassthru($h);
  19. fclose($h);
  20. echo "\n";
  21. $h = fopen($relfile, "r", true, $ctx);
  22. fpassthru($h);
  23. fclose($h);
  24. echo "\n";
  25. unlink($absfile);
  26. unlink($relfile);
  27. ?>
  28. --EXPECT--
  29. *** Testing fopen() : variation ***
  30. This is an absolute file
  31. This is a relative file