Using file-related error information : fwrite « File Directory « PHP






Using file-related error information

 
<?php
$fh = fopen('/tmp/cookie-data','w')      or die("can't open: $php_errormsg");
if (-1 == fwrite($fh,$_COOKIE['flavor'])) { die("can't write: $php_errormsg") };
fclose($fh)                              or die("can't close: $php_errormsg");
?>
  
  








Related examples in the same category

1.A simple access counter
2.Appending to a file
3.fwrite() function writes string to the file.
4.fwrite.php
5.Writing data to a file
6.Storing user information in a text file