problem with file writing
| From: | Ben Waldher | Date: | Sun, 17 Mar 2002 04:53:39 +0000 |
| Subject: | problem with file writing | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-88808@lists.php.net to get a copy of this message | ||
I'm having some trouble writing data to a file, when I use this code it
works fine:
<?php
$file = fopen("template.txt", "w");
fwrite ($file, $temp);
fclose ($file);
?>
But several problems with this occur:
<?php
$stuff = include ("news.txt");
$file = fopen ("news.txt", "w");
$newnews = include ("template.txt") . $stuff;
fwrite ($file, $newnews);
?>
First of all, it tries to open template.txt1 instead of template.txt.
Second of all, some letters written to news.txt become a 1 for some odd
reason. I don't know why.
I am using a windows server and I have tried using the mode "wb" but it
doesn't help.