php5.6关键词过滤扩展php-ext-trie-filter添加

本文介绍了一种基于Double-Array Trie树实现的敏感词过滤扩展的安装过程,包括安装libiconv、libdatrie及trie-filter的具体步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

php extension for spam word filter based on Double-Array Trie tree, it can detect if a spam word exists in a text message.

关键词过滤扩展,用于检查一段文本中是否出现敏感词,基于Double-Array Trie 树实现。

1、安装libiconv,这个是libdatrie的依赖项
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar zxvf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure
make && make install && ldconfig

2、安装libdatrie (http://linux.thai.net/~thep/datrie/datrie.html)
wget ftp://linux.thai.net/pub/ThaiLinux/software/libthai/libdatrie-0.2.4.tar.gz
tar zxf libdatrie-0.2.4.tar.gz 
cd libdatrie-0.2.4 
make clean
./configure LDFLAGS=-L/usr/local/lib LIBS=-liconv --prefix=/usr/local/libdatrie
make && make install

3、添加trie-filter
yum install unzip -y
wget https://github.com/wulijun/php-ext-trie-filter/archive/master.zip

#php7.0.13使用 https://github.com/zzjin/php-ext-trie-filter/archive/php7.zip

unzip master.zip
cd php-ext-trie-filter-master
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-trie_filter=/usr/local/libdatrie
make && make install
echo "extension=trie_filter.so" >> /usr/local/php/etc/php.ini
重启php-fpm即可

转载于:https://my.oschina.net/HeAlvin/blog/793030

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值