According to customer requirements, they can manually set and filter some keywords that should not appear in the background, so I wrote the following code, character filtering program
function filter_words($str){
$sql = "Select * from gx_filter where id=1 limit 1";
$result = mysql_query($sql);
$rs = mysql_fetch_array($result);
$array = explode('|',$rs['filter_words']);
if( is_array($array) ){
$array_length = sizeof($array);
for($i=0;$i< $array_length; $i++){
$str = @str_replace($array[$i],'',$str);
}
}
return $str;
}
Read the characters that the customer wants to filter from the database, and then process them as above.
Application: For original reprints on this site, please indicate www.111cn.cn/phper/php.html