经测试代码如下:
/**
* 替换html标签为特定字符
*
* @param
* @arrange (512.笔记) jb51.cc
* $content = text you want to parse
* $replacement = what you want to replace the tags with (Defaults to a space).
**/
function tagStripReplace($content,$replacement = " "){
return preg_replace("~<(w*[^>])*>~",$replacement,$content);
}
echo tagStripReplace("<p>I like pizza</p>",";");
echo tagStripReplace("<p>I like pizza</p><p>Do you?</p>");
/*** 来自编程之家 jb51.cc(jb51.cc) ***/
原文链接:https://www.f2er.com/php/528979.html