且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用PHP替换文本文件中的字符串

更新时间:2023-02-23 09:07:07

这项工作是

$msgid = $_GET['msgid'];

$oldMessage = '';

$deletedFormat = '';

//read the entire string
$str=file_get_contents('msghistory.txt');

//replace something in the file string - this is a VERY simple example
$str=str_replace($oldMessage, $deletedFormat,$str);

//write the entire string
file_put_contents('msghistory.txt', $str);