1. Go to this page and download the library: Download guanhui07/dfa-sensitive 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/ */
guanhui07 / dfa-sensitive example snippets
use DfaFilter\SensitiveHelper;
// 获取感词库索引数组
$wordData = array(
'察象蚂',
'拆迁灭',
'车牌隐',
'成人电',
'成人卡通',
......
);
// get one helper
$handle = SensitiveHelper::init()->setTree($wordData);
// 获取感词库文件路径
$wordFilePath = 'tests/data/words.txt';
// get one helper
$handle = SensitiveHelper::init()->setTreeByFile($wordFilePath);