21,873
社区成员




/*纪录非法关键字表的结构
id
key
*/
$txt = file_get_contents('test.txt'); // 文章内容
// 读取非法关键字表
$sqlstr = "select * from table";
$query = @mysql_query($sqlstr) or die(mysql_error());
$keys = array();
while($thread = mysql_fetch_assoc($query)){
$keys[] = $thread['key'];
}
// 纪录文章中包含的非法关键字
$result = array();
foreach($keys as $k=>$v){
if(strpos($txt, $key)!==false){
array_push($result, $key);
}
}
// 打印文章中包含的非法关键字
print_r($result);