PHP头条
热点:

php 介绍两种过滤html标签的方法


php自带函数strip_tags
echo strip_tags("hello <b>world! www.ite5e.com</b>");

自定义函数:
function filterhtml($str) {
        $str=eregi_replace("</*[^<>]*>", , $str);
        $str=str_replace(" ", , $str);
        $str=str_replace("n", , $str);
        $str=str_replace("t", , $str);
        $str=str_replace("::", :, $str);
        $str=str_replace(" ", , $str);
   //$str=str_replace("&nbsp;", , $str);
        return $str;
}
$str = "<a href=#>www.111cn.net</a>";
调用函数 echo filterhtml($str);

www.phpzy.comtrue/phprm/25049.htmlTechArticlephp 介绍两种过滤html标签的方法 php自带函数strip_tags echo strip_tags("hello bworld! www.ite5e.com/b"); 自定义函数: function filterhtml($str) { $str=eregi_replace("/*[^]*", , $str); $str=str_replace(" ", , $str); $str=s...

相关文章

    暂无相关文章

PHP之友评论

今天推荐