当前位置 : 主页 > 网络编程 > PHP >

php去除html标签代码

来源:互联网 收集:自由互联 发布时间:2021-07-03
? function Text2Html($txt){ $txt = str_replace(" "," ",$txt); $txt = str_replace("","lt;",$txt); $txt = str_replace("","gt;",$txt); $txt = preg_replace("/[rn]{1,}/isU"," rn",$txt); return $txt; } ?
<? 
function Text2Html($txt){ 
        $txt = str_replace("  "," ",$txt); 
        $txt = str_replace("<","&lt;",$txt); 
        $txt = str_replace(">","&gt;",$txt); 
        $txt = preg_replace("/[rn]{1,}/isU"," 
rn",$txt); 
        return $txt; 
} 

?> 
网友评论