PHP code example of phpch / imi-sensitive-word-filter

1. Go to this page and download the library: Download phpch/imi-sensitive-word-filter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

phpch / imi-sensitive-word-filter example snippets


'SensitiveWordFilter' => [
		'type' => 'mysql', // array,file, mysql
		'matchType' => 1, // 1:最小匹配规则,如:敏感词库["中国","中国人"],语句:"我是中国人",匹配结果:我是[中国]人,2:最大匹配规则,如:敏感词库["中国","中国人"],语句:"我是中国人",匹配结果:我是[中国人]
		'array' => [
			"中国",
			"中国人"
		],// 敏感词列表
		'mysql' => [
			'model' => \ImiApp\ApiServer\Model\EkSensitiveWord::class, // 模型名称
			'field' => 'word', // 敏感词字段
		],
		'file' => [],// 文件列表
		'disturbList'=>['&','-'], // 干扰因子集合
	],