Re: Writing files a problem
| From: | Jason Wong | Date: | Sun, 17 Mar 2002 17:10:46 +0000 |
| Subject: | Re: Writing files a problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-88836@lists.php.net to get a copy of this message | ||
On Monday 18 March 2002 00:46, Ben Waldher wrote:
> When writing to a file several problems occur with this code:
>
> <?php
> $stuff = include ("news.txt");
> $file = fopen ("news.txt", "w");
> $newnews = include ("template.txt") . $stuff;
> fwrite ($file, $newnews);
> ?>
>
> However, this code works:
>
> <?php
> $file = fopen("template.txt", "w");
> fwrite ($file, $temp);
> fclose ($file);
> ?>
>
> The problem with the first set of code is that it opens template.txt1, and
> some letters that were in template.txt become a 1.
I've already replied to this before. The include() statement is NOT what you
want. Have a look at the functions in the chapter "Filesystem functions".
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
Please ignore previous fortune.
*/