PHP实现对各种HTML标记的过滤。
首先,分享一些更常见的$str = preg_replace( / } * * = *(监测的| )(。*) 1
$str = preg_replace( / / +
$str = preg_replace(} + /硅/ < {
$str = preg_replace( / /硅
$str = preg_replace( / /硅
$str = preg_replace( / /硅
$str = preg_replace( / /硅
$str = preg_replace( / /硅
$str = preg_replace( / /硅
$str = preg_replace( / /硅
$str = preg_replace( / /硅
$str = preg_replace( /饼干/硅
$str = preg_replace( /(。*)
$str = preg_replace( / /硅
$str = preg_replace( /(。*)
$str = preg_replace( / /硅
$str = preg_replace( /(。*)
$str = preg_replace( / /硅
$str = preg_replace( /(。*)
$str = preg_replace( / /硅
$str = preg_replace( /(。*)
$str = preg_replace( / /硅
$str = preg_replace( /(。*)
$str = preg_replace( / /硅
$str = preg_replace( /(。*)
$str = preg_replace( / /硅
$str = preg_replace( / /硅Javascript
$str = preg_replace( / /硅VBscript
$str = preg_replace( /({ A-Z } +)* = /硅
$str = preg_replace( / / # Si
一种更简单的写作方法:
功能delhtml($str){ / /删除HTML标签
$ = 1
$ = 1
STMP =阵列(美元);
STMP { } =美元;
$ len = strlen(str);
($ i = 0;$ i;
SS substr($str =美元,$我,1);
如果(ORD($ SS)= = 60){ / / ORD(<)= = 60
美元= $ I;
}
如果(ORD($ SS)= = 62){ / / ORD(>)= = 62
ET $ I;
如果(st)!= 1){
{ } = substr(STMP美元美元美元美元的STR,ST,ST等美元+ 1);
}
}
}
$str = str_replace($ STMP,
返回$ STR;
}
一个多uff1a
功能clear_html_label($ HTML)
{
$搜索=阵列(''si
$ =数组(
返回preg_replace(元搜索,取代美元,美元的HTML);
}
以上三种方法均可实现,但各有优缺点,合作伙伴将根据自己的项目需求进行选择。