t_machine Posted January 31, 2007 Share Posted January 31, 2007 hi, I am creating a script that I would like to open a specific file then seach for a phrase (eg. //add text here) then place new codes there.I think the script will need to first check if the file is writable and if not, make it writable then open the file and search for the phrase. It should then close the file and return to previous file permission.Any help on this would be really great. Thanks :) Quote Link to comment Share on other sites More sharing options...
chronister Posted January 31, 2007 Share Posted January 31, 2007 http://us2.php.net/manual/en/function.file.phphttp://us2.php.net/manual/en/function.file-get-contents.phphttp://us2.php.net/str_replacethose 3 manual pages should give you exactly what you need. note the differences between file() and file_get_contents() 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.