php 过滤 html 将html 标签转换成普通字符

方法如下:

    public static function unhtml($content){
        $content=htmlspecialchars($content);
        $content=str_ireplace(chr(13),"<br>",$content);
        $content=str_ireplace(chr(32)," ",$content);
        $content=str_ireplace("[_[","<",$content);
        $content=str_ireplace(")_)",">",$content);
        $content=str_ireplace("|_|"," ",$content);
        return trim($content);
    }

发表评论