板邓: php 过滤文章的html标签方法

php 过滤文章的html标签方法

function aplay_shuju( $shuju ){
        $shuju=str_replace("\"", """,$shuju);//替换超链接反斜杠,防止插入数据库出现bug
        $shuju=str_replace("
", "<p></p>",$shuju);    //替换回车   
        $shuju = preg_replace("/style=.+?['|"]/i","",$shuju);//去除style样式 
        $shuju = preg_replace("/class=.+?['|"]/i","",$shuju);//去除class样式    
        $shuju = preg_replace("/id=.+?['|"]/i","",$shuju);//去除id样式    
        $shuju=str_replace( "&nbsp;","",$shuju); 
        return $shuju;
    }
板邓个人博客:http://8dseo.com
原文地址:https://www.cnblogs.com/xbdeng/p/6872798.html