时间:2021-07-01 10:21:17 帮助过:17人阅读
$body =<<< 'TXT'各位,我想输出的$body读取的内容,同时替换掉里面的“#p#副标题#e#” “'请看下一页” “/uploads”TXT;$body = str_replace('#p#副标题#e#','',$body);$body = str_replace('请看下一页', '',$body);$body = str_replace('/uploads', 'http://www.****.com/uploads',$body);echo $body;写成这样更简捷
body =<<< 'TXT'各位,我想输出的$body读取的内容,同时替换掉里面的“#p#副标题#e#” “'请看下一页” “/uploads”TXT;$p = array('#p#副标题#e#', '请看下一页', '/uploads');$r = array('','', 'http://www.****.com/uploads');echo str_replace($p, $r, $body);
header("Content-type: text/html; charset=utf-8");$body = <<" . $body . "
楼上的都是正解
可以用正则,把这三个拼成一个正则即可
第一次替?完后,就不要用$body了,而是用$content?行后面的替?。
$content = str_replace('#p#副标题#e#','',$body);$content = str_replace('请看下一页', '',$content);$content = str_replace('/uploads', 'http://www.****.com/uploads',$content);