$contents = preg_replace("/\s+/", " ", $contents); //過濾多餘回車
$contents=preg_replace("/<[ ]+/si","<",$contents); //過濾<__("<"號後面帶空格)
$contents=preg_replace("/<\!--.*?-->/si","",$contents); //註釋
$contents=preg_replace("/<(\!.*?)>/si","",$contents); //過濾DOCTYPE
$contents=preg_replace("/<(\/?html.*?)>/si","",$contents); //過濾html標籤
$contents=preg_replace("/<(\/?meta.*?)>/si","",$contents); //過濾meta標籤
$contents=preg_replace("/<(\/?body.*?)>/si","",$contents); //過濾body標籤
$contents=preg_replace("/<(\/?link.*?)>/si","",$contents); //過濾link標籤
$contents=preg_replace("/<(\/?form.*?)>/si","",$contents); //過濾form標籤
$contents=preg_replace("/cookie/si","COOKIE",$contents); //過濾COOKIE標籤
$contents=preg_replace("/<(applet.*?)>(.*?)<(\/applet.*?)>/si","",$contents); //過濾applet標籤
$contents=preg_replace("/<(\/?applet.*?)>/si","",$contents); //過濾applet標籤
$contents=preg_replace("/<(style.*?)>(.*?)<(\/style.*?)>/si","",$contents); //過濾style標籤
$contents=preg_replace("/<(\/?style.*?)>/si","",$contents); //過濾style標籤
$contents=preg_replace("/<(title.*?)>(.*?)<(\/title.*?)>/si","",$contents); //過濾title標籤
$contents=preg_replace("/<(\/?title.*?)>/si","",$contents); //過濾title標籤
$contents=preg_replace("/<(object.*?)>(.*?)<(\/object.*?)>/si","",$contents); //過濾object標籤
$contents=preg_replace("/<(\/?objec.*?)>/si","",$contents); //過濾object標籤
$contents=preg_replace("/<(noframes.*?)>(.*?)<(\/noframes.*?)>/si","",$contents); //過濾noframes標籤
$contents=preg_replace("/<(\/?noframes.*?)>/si","",$contents); //過濾noframes標籤
$contents=preg_replace("/<(i?frame.*?)>(.*?)<(\/i?frame.*?)>/si","",$contents); //過濾frame標籤
$contents=preg_replace("/<(\/?i?frame.*?)>/si","",$contents); //過濾frame標籤
$contents=preg_replace("/<(script.*?)>(.*?)<(\/script.*?)>/si","",$contents); //過濾script標籤
$contents=preg_replace("/<(\/?script.*?)>/si","",$contents); //過濾script標籤
$contents=preg_replace("/javascript/si","Javascript",$contents); //過濾script標籤
$contents=preg_replace("/vbscript/si","Vbscript",$contents); //過濾script標籤
$contents=preg_replace("/on([az]+)\s*=/si","On\\1=",$contents); //過濾script標籤
$contents=preg_replace("/&#/si","&#",$contents); //過濾script標籤,如javAsCript:alert('aabb)
$contents=preg_replace("/<(\/?table.*?)>/si","",$contents); //過濾table標籤
$contents=preg_replace("/<(\/?tr.*?)>/si","",$contents); //過濾tr標籤
$contents=preg_replace("/<(\/?tbody.*?)>/si","",$contents); //過濾tbody標籤
$contents=preg_replace("/<(\/?td.*?)>/si",",",$contents); //過濾td標籤
$contents=preg_replace("/<(\/?img.*?)>/si","",$contents); //過濾img標籤
$contents=preg_replace("/<(\/?input.*?)>/si","",$contents); //過濾input標籤
$contents=preg_replace("/<(\/?font.*?)>/si","",$contents); //過濾font標籤
$contents=preg_replace("/<(\/?th.*?)>/si","",$contents); //過濾th標籤
$contents=preg_replace("/<(head.*?)>(.*?)<(\/head.*?)>/si","",$contents); //過濾head標籤
$contents=preg_replace("/<(select.*?)>(.*?)<(\/select.*?)>/si","",$contents); //過濾select標籤
$contents=preg_replace("/<(strong.*?)>(.*?)<(\/strong.*?)>/si","",$contents); //過濾strong標籤
$contents=preg_replace("/<(label.*?)>(.*?)<(\/label.*?)>/si","",$contents); //過濾label標籤
$contents=preg_replace("/<(a.*?)>(.*?)<(\/a.*?)>/si","",$contents); //過濾a標籤
|