// 关键字过滤函数
function keyWordCheck($content){
// 去除空白
$content = trim($content);
// 读取关键字文本
$content = @file_get_contents('keyWords.txt');
// 转换成数组
$arr = explode("n", $content);
// 遍历检测
for($i=0,$k=count($arr);$i<$k;$i++){
// 如果此数组元素为空则跳过此次循环
if($arr[$i]==''){
continue;
}
// 如果检测到关键字,则返回匹配的关键字,并终止运行
// 这一次加了 trim()函数
if(@strpos($str,trim($arr[$i]))!==false){
//$i=$k;
return $arr[$i];
}
}
// 如果没有检测到关键字则返回false
return false;
}
猜你喜欢
2019-08-05
function phpasp2($str){if($str!=){$str=trim($str);$huanti=array(?=lt;?,?=?gt;,'=#039;);$str=strtr($str,$huanti);return $str;}}
2019-08-01
// 关键字过滤函数function keyWordCheck($content){// 去除空白$content = trim($content);// 读取关键字文本$content = @file_get_contents('keyWords.txt');// 转换成数组$arr = explode(n, $content);// 遍
2019-06-10
function cnsubstr($str,$strlen=10) {if(empty($str)||!is_numeric($strlen)){return false;}if(strlen($str)=$strlen){ return $str; }//得到第$length个字符 并判断是否为非中文 若为非中文//直接返回$lengt
2019-04-25
function getlenstr($len,$str){for ($i=0;$i$len;$i++){$returnstr.=$str;}return $returnstr;}
2019-02-28
function mymd5($string,$action=EN){ //字符串加密和解密global $webdb,$onlineip;//$webdb系统的一些配置信息,$onlineip 客户端ip 这个函数好像没有用到$secret_string = $webdb[mymd5].'5*j,.^;?.%#@!'; //绝密字
2018-10-24
//验证码class Captcha{private $width;private $height;private $codeNum;private $code;private $im;function __construct($width=80, $height=20, $codeNum=4){$this-width = $width;$this-height = $height;$thi