一区二区久久-一区二区三区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)系我們修改或刪除,多謝。

主站蜘蛛池模板: 亚洲国产成人久久一区www | 国产成人啪精品视频免费网 | 韩国日本一区 | se97se成人亚洲网站在线观看 | 日韩欧美不卡片 | 99久久精品免费看国产四区 | 开心丁香婷婷深爱五月 | xxxxxx日本处大片免费看 | 国产成人精品影视 | 精品国产免费第一区二区三区日韩 | 国产 麻豆 | 一本色道久久88加勒比—综合 | 亚洲国产成人久久精品动漫 | 国产大片视频免费观看 | 成人春色在线观看免费网站 | 国产精品久久久久亚洲 | 欧美亚洲另类色国产综合 | 色多多网站在线观看 | 国产视频高清 | www.国产网站 | 久久九九视频 | 蜜桃视频成人免费版在线 | 成人三级视频 | 在线观看免费黄色小视频 | 天天综合网网欲色 | 狂野欧美性猛交xxxx巴西 | 韩国一级毛片 | 中文字幕一区二区三区免费看 | 亚洲午夜18| 久久精品夜色国产 | 亚洲一区二区三区福利在线 | 欧美日韩免费大片 | 超清乱人伦中文视频在线 | 亚洲美女精品视频 | 五月婷婷在线视频 | 日韩专区中文字幕 | 国产精品视频牛仔裤一区 | 久久98精品久久久久久婷婷 | 天天射天天干天天色 | 天天操天天干天天爽 | 午夜视频91|