"Mark Lo" <[EMAIL PROTECTED]> wrote:
> Is there any function exists which to open a specific file, then find
a
> specific word, if found, then replace that word with something else.
In addition to the solution mentioned using PHP filesystem functions, you
could use Unix command like grep, sed
Hello,
something like this:
$filename="your_file_name.txt";
$fp = fopen($filename, "r+") or die ("Could not open file");
$content = fread ($fp, filesize($filename));
$new_content = str_replace("old_word", "new_word", $content);
rewind($fp);
fwrite($fp, $new_content);
ftruncate($fp, ftell($fp));
f
2 matches
Mail list logo