您的位置:首页 > 编程语言 > PHP开发

php过滤敏感词

2016-12-02 10:47 239 查看
<?php
header('content-type:Text/html; charset=utf-8');
$user=$_POST["text"];
$content=file_get_contents("mingan.txt") ;
$arr=explode("\r\n",$content);

function checker($arr,$user)
{
$result = 0;
for($i=0;$i<count($arr);$i++)
{
preg_match('/'.$arr[$i].'/', $user, $mnt);
if(!empty($mnt)){
$result = 1;
break;
}
}

return $result;
}
if(checker($arr,$user)>0){
echo  "有问题";
}
else{
echo "没有问题";
}
?>


如有转载,请带上地址: http://blog.csdn.net/dear_zx 资源下载地址 : http://download.csdn.net/detail/dear_zx/9699605
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: