// +---------------------------------------------------------------------- // 应用公共文件 /** * 敏感词过滤 * * @param string * @return string */ function sensitive_words_filter($str) { if (!$str) return ''; $file = ROOT_PATH. PUBILC_PATH.'static/plug/censorwords/CensorWords'; $words = file($file); foreach($words as $word) { $word = str_replace(array("\r\n","\r","\n"," "), '', $word); if (!$word) continue; $ret = preg_match("/$word/", $str, $match); if ($ret) { return $match[0]; } } return ''; }