php查找/过滤一段文字中的违禁词敏感词

 

 

 

20){
                $isempyt=true;
                break;
            }
        }while(count($matches)>0 && !$isempyt);

        //查出敏感词
        if($match_banned){
            return $match_banned;
        }
        //没有查出敏感词
        return array();
    }
	
	  /**
     * 打印到页面上
     * @param $filepath
     * @param $res_mingan
     * @param $res_banned
     */
    function write_html($content,$res_banned){
      
            print_r($content);
            if($res_banned){
                print_r("  违禁词(".count($res_banned)."):".implode('|',$res_banned));
            }
            echo "
"; }

  

转载于:https://www.cnblogs.com/kingchou/p/7943446.html

你可能感兴趣的:(php查找/过滤一段文字中的违禁词敏感词)