papaface Posted June 3, 2007 Share Posted June 3, 2007 Hello, How would I go about adding a string on a new line at the end of a text file? Quote Link to comment Share on other sites More sharing options...
bonaparte Posted June 3, 2007 Share Posted June 3, 2007 Hi, Open the file in append mode and fwrite. Here's the example. <?php $myString = "Some text"; $fh=fopen('test.txt',"a"); fwrite($fh,$myString); fclose($fh); ?> Make sure to set appropriate permissions to the file test.txt so that PHP can open it. Quote Link to comment Share on other sites More sharing options...
papaface Posted June 3, 2007 Author Share Posted June 3, 2007 Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.