我有一個過濾器壞字代碼如下 我想用.txt文件替換這個ARRAY,這樣我就可以把所有壞字都放到txt文件中,或者有什麼方法可以使用MYSQL數據庫存儲壞字,然後從那裏打電話?PHP過濾器壞字
FUNCTION BadWordFilter(&$text, $replace){
$bads = ARRAY (
ARRAY("butt","b***"),
ARRAY("poop","p***"),
ARRAY("crap","c***")
);
IF($replace==1) { //we are replacing
$remember = $text;
FOR($i=0;$i<sizeof($bads);$i++) { //go through each bad word
$text = EREGI_REPLACE($bads[$i][0],$bads[$i][1],$text); //replace it
}
IF($remember!=$text) RETURN 1; //if there are any changes, return 1
} ELSE { //we are just checking
FOR($i=0;$i<sizeof($bads);$i++) { //go through each bad word
IF(EREGI($bads[$i][0],$text)) RETURN 1; //if we find any, return 1
}
}
}
$qtitle = BadWordFilter($wordsToFilter,1);
是,無論是TXT和DB是可能的一個功能。你有什麼問題?有什麼問題? – 2012-07-17 13:40:50
我感覺[clbuttic的錯誤](http://thedailywtf.com/Articles/The-Clbuttic-Mistake-.aspx),或在這種情況下,[審查b *** erfly](http:// en。 wikipedia.org/wiki/Scunthorpe_problem) – phihag 2012-07-17 13:47:44