我们为大家收集整理了关于php去除html标签,以方便大家参考。
//去除html标记
function text2html($txt){
$txt = str_replace(" "," ",$txt);
$txt = str_replace("<","<",$txt);
$txt = str_replace(">",">",$txt);
$txt = preg_replace("/[ ]{1,}/isu","
",$txt);
return $txt;
}
//清除html标记
function clearhtml($str){
$str = str_replace('<','<',$str);
$str = str_replace('>','>',$str);
return $str;
}
希望大家可以学会php去除html标签想了解更多精彩内容,请关注我们的网站!
相关推荐:
js过滤html标签技巧