Created
December 6, 2012 06:06
-
-
Save cloudsben/4222129 to your computer and use it in GitHub Desktop.
敏感词过滤
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkUploadText($content) | |
{ | |
$stoptext = file_get_contents($this->CI->config->item('stopword_file')); | |
$stoptext = str_replace("\n",'',$stoptext); | |
$stoptext = str_replace("\r",'',$stoptext); | |
$stopwords = array_map('strtolower',explode(',',$stoptext)); | |
$content = strtolower($content); | |
$ret = array('ret'=>1,'word'=>''); | |
if($content!='') | |
foreach($stopwords as $row) | |
{ | |
if(trim($row)!='') | |
{ | |
if(strpos($content,$row)===false) | |
continue; | |
else | |
{ | |
$ret = array('ret'=>0,'word'=>$row); | |
break; | |
} | |
} | |
} | |
return $ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment