Richard Kurth wrote:
How can I read through a file and find a string and then replace it with a
new string and then save the whole file.
Below is a peace of what I need to search through. I need to find the string
subscribe_policy = open and replace it with subscribe_policy = open+confirm.
Then sa
$filename = '/path/to/file.txt';
$contents = file_get_contents($filename);
$contents = str_replace($search,$replace,$contents);
$handle = fopen($filename, "w");
if (fwrite($handle, $contents)) {
echo 'file write successful';
} else {
echo 'file write failed';
exit;
}
fclose($handle);
al
How can I read through a file and find a string and then replace it with a
new string and then save the whole file.
Below is a peace of what I need to search through. I need to find the string
subscribe_policy = open and replace it with subscribe_policy = open+confirm.
Then save the whole file.
I
How can I read through a file and find a string and then replace it with a
new string and then save the whole file.
Below is a peace of what I need to search through. I need to find the string
subscribe_policy = open and replace it with subscribe_policy = open+confirm.
Then save the whole file.
I
4 matches
Mail list logo