我已經設定該功能php字符過濾器功能?
function bad_words($val){
global $pre;
$sql = mysql_query("SELECT * FROM " . $pre . "BAD_WORDS") or die(mysql_error());
$rs = mysql_fetch_assoc($sql);
if (mysql_num_rows($sql) > 0) {
$bad_words = $rs['BAD_WORD'];
$replace = $rs['REPLACE'];
}
$val = str_ireplace($bad_words, $replace, $val);
return $val;
}
BAD_WORDS Table (ID, BAD_WORD, REPLACE)
當我使用這個功能,它取代字與ID = 1,但不會取代其他的話。
我錯過了什麼?
[。如果你想在褻瀆過濾器的設想一些反饋](http://www.codinghorror.com/blog/2008/10/obscenity-filters-bad -idea-or-illredibly-intercoursing-bad-idea.html) –
'$ pre'變量中的內容是什麼? – Ibu
我也認爲'全球'是一個壞詞。 'mysql_ *'以及順便說一句。 – PeeHaa