一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

php過(guò)濾HTML標(biāo)簽、屬性等正則表達(dá)式匯總

$str=preg_replace("http://s+/", " ", $str); //過(guò)濾多余回車$str=preg_replace("/<[ ]+/si","<",$str); //過(guò)濾<__("<"號(hào)后面帶空格) $str=preg_replace("/</!--.*?-->/si","",$str); //注釋$str=preg_replace("/<(/!.*?)>/si","",$str); //過(guò)濾DOCTYPE$str=preg_replace("/<(//?html.*?)>/si","",$str); //過(guò)濾html標(biāo)簽$str=preg_replace("/<(//?head.*?)>/si","",$str); //過(guò)濾head標(biāo)簽$str=preg_replace("/<(//?meta.*?)>/si","",$str); //過(guò)濾meta標(biāo)簽$str=preg_replace("/<(//?body.*?)>/si","",$str); //過(guò)濾body標(biāo)簽$str=preg_replace("/<(//?link.*?)>/si","",$str); //過(guò)濾link標(biāo)簽$str=preg_replace("/<(//?form.*?)>/si","",$str); //過(guò)濾form標(biāo)簽$str=preg_replace("/cookie/si","COOKIE",$str); //過(guò)濾COOKIE標(biāo)簽 $str=preg_replace("/<(applet.*?)>(.*?)<(//applet.*?)>/si","",$str); //過(guò)濾applet標(biāo)簽$str=preg_replace("/<(//?applet.*?)>/si","",$str); //過(guò)濾applet標(biāo)簽 $str=preg_replace("/<(style.*?)>(.*?)<(//style.*?)>/si","",$str); //過(guò)濾style標(biāo)簽$str=preg_replace("/<(//?style.*?)>/si","",$str); //過(guò)濾style標(biāo)簽 $str=preg_replace("/<(title.*?)>(.*?)<(//title.*?)>/si","",$str); //過(guò)濾title標(biāo)簽$str=preg_replace("/<(//?title.*?)>/si","",$str); //過(guò)濾title標(biāo)簽 $str=preg_replace("/<(object.*?)>(.*?)<(//object.*?)>/si","",$str); //過(guò)濾object標(biāo)簽$str=preg_replace("/<(//?objec.*?)>/si","",$str); //過(guò)濾object標(biāo)簽 $str=preg_replace("/<(noframes.*?)>(.*?)<(//noframes.*?)>/si","",$str); //過(guò)濾noframes標(biāo)簽$str=preg_replace("/<(//?noframes.*?)>/si","",$str); //過(guò)濾noframes標(biāo)簽 $str=preg_replace("/<(i?frame.*?)>(.*?)<(//i?frame.*?)>/si","",$str); //過(guò)濾frame標(biāo)簽$str=preg_replace("/<(//?i?frame.*?)>/si","",$str); //過(guò)濾frame標(biāo)簽 $str=preg_replace("/<(script.*?)>(.*?)<(//script.*?)>/si","",$str); //過(guò)濾script標(biāo)簽$str=preg_replace("/<(//?script.*?)>/si","",$str); //過(guò)濾script標(biāo)簽$str=preg_replace("/Javascript/si","Javascript",$str); //過(guò)濾script標(biāo)簽$str=preg_replace("/vbscript/si","Vbscript",$str); //過(guò)濾script標(biāo)簽$str=preg_replace("/on([a-z]+)/s*=/si","On//1=",$str); //過(guò)濾script標(biāo)簽$str=preg_replace("/&#/si","&#",$str); //過(guò)濾script標(biāo)簽,如JavasCript:alert( 

清除空格,換行

function DeleteHtml($str){$str = trim($str);$str = strip_tags($str,"");$str = ereg_replace("/t","",$str);$str = ereg_replace("/r/n","",$str);$str = ereg_replace("/r","",$str);$str = ereg_replace("/n","",$str);$str = ereg_replace(" "," ",$str);return trim($str);}

過(guò)濾HTML屬性

1,過(guò)濾所有html標(biāo)簽的正則表達(dá)式:
復(fù)制代碼 代碼如下: 
</?[^>]+>
 
//過(guò)濾所有html標(biāo)簽的屬性的正則表達(dá)式:
 
$html = preg_replace("/<([a-zA-Z]+)[^>]*>/","<//1>",$html);

3,過(guò)濾部分html標(biāo)簽的正則表達(dá)式的排除式(比如排除<p>,即不過(guò)濾<p>):
復(fù)制代碼 代碼如下:
</?[^pP/>]+>

4,過(guò)濾部分html標(biāo)簽的正則表達(dá)式的枚舉式(比如需要過(guò)濾<a><p><b>等):
復(fù)制代碼 代碼如下:
</?[aApPbB][^>]*>

5,過(guò)濾部分html標(biāo)簽的屬性的正則表達(dá)式的排除式(比如排除alt屬性,即不過(guò)濾alt屬性):
復(fù)制代碼 代碼如下:
/s(?!alt)[a-zA-Z]+=[^/s]*

6,過(guò)濾部分html標(biāo)簽的屬性的正則表達(dá)式的枚舉式(比如alt屬性):
復(fù)制代碼 代碼如下:
(/s)alt=[^/s]*

php技術(shù)php過(guò)濾HTML標(biāo)簽、屬性等正則表達(dá)式匯總,轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 五月丁香六月婷综合缴情在线 | 四虎现在的网址入口2022 | 国产丝袜美腿高跟白浆 | 色婷婷基地 | 天天视频免费入口 | 久久久久久91精品色婷婷 | 1区2区3区4区| 视频区小说区 | 精品视频免费观看 | 日韩精品123| 国产视频一区二区 | 国产精品视频一区二区三区经 | 国产伦精品一区二区三区 | 激情网站网址 | 日本午夜vr影院新入口 | 永久免费av网站 | 69国产精品视频免费 | 久草热视频在线 | 99在线精品日韩一区免费国产 | 97色精品视频在线观看免费 | 777久久婷婷成人综合色 | 九九51精品国产免费看 | 免费popnhub国产在线视频 | 九九久久久久午夜精选 | 91精品自在拍精选久久 | 黄色在线观看www | 91免费观看视频 | 日韩久久久精品首页 | 国产日韩欧美不卡www | 亚洲性久久 | 伊人亚洲综合 | 久久久久久久影院 | 正在播放91| 免费精品在线 | 一区二区三区视频在线 | 国产精品自在线 | 精品久久久一二三区 | 精品国产免费一区二区三区 | com欧美| 四虎影在线永久免费观看 | 久久久久久91|