terryoleary1981 Posted November 16, 2006 Share Posted November 16, 2006 Hi guysI've not used the file method extensively but i'm currently creating a web application. What i was to happen is a set of html files reside in a folder i copy these files via a php script and place them into a folder (already created)then what i want to do it to parse the file and when certain flags appear in the page i want to write to the filefor example if i had this template....<body><h1> hello %name-here%</h1></body....i'd want to parse this file and match the %name-here% at which point the php file can write to the page and replace it with something from a database?does that make sense i hope so, if anyone can tell me how to write to a file at a certain position would be much appreciated all i can find is appending to the end of the file- Terry Link to comment https://forums.phpfreaks.com/topic/27442-solve-a-fopen-fwrite-problem/ Share on other sites More sharing options...
Orio Posted November 16, 2006 Share Posted November 16, 2006 To get the contents of the file, use [url=http://www.php.net/file-get-contents]file_get_contents()[/url].For replaceing, look into [url=http://www.php.net/str-replace]str_replace()[/url] or [url=http://www.php.net/preg-replace]preg_replace()[/url].Orio. Link to comment https://forums.phpfreaks.com/topic/27442-solve-a-fopen-fwrite-problem/#findComment-125523 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.