Re: Add lines to a text file
| From: | Kent Sandvik | Date: | Wed, 11 Dec 2002 21:41:52 +0000 |
| Subject: | Re: Add lines to a text file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-127908@lists.php.net to get a copy of this message | ||
On Wednesday, Dec 11, 2002, at 13:36 US/Pacific, Antti wrote:
Thanks it works. I forgot to say that i need to add a new line to that file. Now it puts all the stuff at the same line. How do I make it to add lines?Use fputs with the string ending with a \n, as in:
$xmlfp = fopen($theXMLFile, "a");
fputs($xmlfp, "<?xml version=\"1.0\" encoding=\"ISO-8869-1\" ?>\n");
fputs($xmlfp, "<design type=\"developer\">\n");
.....
fputs($xmlfp, "</design>\n");
fclose($xmlfp);
terveisia, Kent