我們為大家收集整理了關於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標簽技巧