darkeye Posted December 4, 2009 Share Posted December 4, 2009 Hello, I have a fairly simple problem, I'm just new to PHP programming, so I hope you can help me! Here is my issue. I want a PHP file to be able to edit itself. I can append to the file, using file_put_contents, but the problem is the PHP close tag, ?>. How would I overwrite those two characters so I can add to the script itself, rather than just append to the file? Thanks a lot! Link to comment https://forums.phpfreaks.com/topic/183926-edit-file-with-php/ Share on other sites More sharing options...
JAY6390 Posted December 4, 2009 Share Posted December 4, 2009 This sounds like a really bad idea to be honest Why not just use one script to edit your other scripts? Link to comment https://forums.phpfreaks.com/topic/183926-edit-file-with-php/#findComment-970952 Share on other sites More sharing options...
darkeye Posted December 4, 2009 Author Share Posted December 4, 2009 Fair Enough I was thinking about that originally but I wondered if it would be easier... So how would I do that then? I can append to the end of the file, but I want to edit inside the php tags. Thanks! Link to comment https://forums.phpfreaks.com/topic/183926-edit-file-with-php/#findComment-970957 Share on other sites More sharing options...
JAY6390 Posted December 4, 2009 Share Posted December 4, 2009 It would be better to just open the file using file_get_contents, then allow to edit the whole file, then save all the content over the original Link to comment https://forums.phpfreaks.com/topic/183926-edit-file-with-php/#findComment-970958 Share on other sites More sharing options...
darkeye Posted December 4, 2009 Author Share Posted December 4, 2009 Thanks a lot Link to comment https://forums.phpfreaks.com/topic/183926-edit-file-with-php/#findComment-970959 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.