10-09-2008, 09:27 AM
|
#2 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
Half way there, at the moment your script should read each line, but it wont write to file.
How about this:
PHP Code:
<?php $szFile= 'file.txt'; // File we want to manipulate $szFind = '<!-- comment -->'; // Our search $szReplace = "Blah blah blah\r\n<!-- comment -->"; // Our replace string
$szFileText = file_get_contents($szFile); // Get file the files contents $pFh = fopen($szFile, 'w+'); // Open a file handle $szFileText = str_replace($szFind, $szReplace, $szFileText); // Do string replace fwrite($pFh, $szFileText); // Write text to file fclose($pFh); //Close handle
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|