note 21043 rejected from function.fwrite by alindeman
| From: | alindeman@php.net | Date: | Fri, 26 Apr 2002 20:52:46 +0000 |
| Subject: | note 21043 rejected from function.fwrite by alindeman | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-29893@lists.php.net to get a copy of this message | ||
I'm trying to write a php script that appends to a file on a unix system.
I've done the following:
<html>
<title>File Write Experiment</title>
<body>
<?php
$linefeed = chr10;
$fp = fopen ("/tmp/file.txt", "aw");
if ($fp)
{ print"The file exists!"; }
else
{ print"The file does NOT exist";}
$number = 0;
while ($number<5)
{
print "Now writing... $number $linefeed";
$fp = fwrite ($fp, $number);
$fp = fwrite ($fp, $linefeed);
$number++;
}
$fp = fwrite ($fp, "DONE");
$fclose ($fp);
?>
The file should now be closed.
</body>
</html>
My text file only has 1 character
0
Can anyone help me?