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 :) Link to comment https://forums.phpfreaks.com/topic/36460-how-to-open-php-file-then-add-codes/ 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() Link to comment https://forums.phpfreaks.com/topic/36460-how-to-open-php-file-then-add-codes/#findComment-173539 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.