DanC Posted September 10, 2009 Share Posted September 10, 2009 Hi, I have a file "install.php" which contains basic input data, ready to write to a "config.php" file. However, the install.php has a lot of data to write to config.php, not just the user input $_POST details, but a lot of pre-defined functions too. I can't put these all in a $ variable because it contains many " and '. How would I go about writing a large amount of data? Thanks. Link to comment https://forums.phpfreaks.com/topic/173850-writing-large-data-to-file/ Share on other sites More sharing options...
PFMaBiSmAd Posted September 10, 2009 Share Posted September 10, 2009 Your config.php should ONLY contain configuration information that changes on each instillation. If you have code that needs to be included, put it into a different file, such as functions.php Link to comment https://forums.phpfreaks.com/topic/173850-writing-large-data-to-file/#findComment-916417 Share on other sites More sharing options...
l0ve2hat3 Posted September 10, 2009 Share Posted September 10, 2009 http://us.php.net/fwrite <?php $fp = fopen('data.txt', 'w'); fwrite($fp, '1'); fwrite($fp, '23'); fclose($fp); ?> Link to comment https://forums.phpfreaks.com/topic/173850-writing-large-data-to-file/#findComment-916421 Share on other sites More sharing options...
DanC Posted September 11, 2009 Author Share Posted September 11, 2009 Thanks very much, both of you. I'll try that when I get home. Link to comment https://forums.phpfreaks.com/topic/173850-writing-large-data-to-file/#findComment-916533 Share on other sites More sharing options...
DanC Posted September 11, 2009 Author Share Posted September 11, 2009 How would I go about making double paragraph spacing between each piece of code written to config.php? Link to comment https://forums.phpfreaks.com/topic/173850-writing-large-data-to-file/#findComment-916884 Share on other sites More sharing options...
l0ve2hat3 Posted September 12, 2009 Share Posted September 12, 2009 <?php $fp = fopen('data.txt', 'w'); fwrite($fp, '1'); fwrite($fp, "\n\n"); fwrite($fp, '23'); fclose($fp); ?> Link to comment https://forums.phpfreaks.com/topic/173850-writing-large-data-to-file/#findComment-917270 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.