PHP敏感词过滤【整理实践版】

因为国内互联网管制政策,强大的敏感词过滤系统成为了每个网站必须具有的基本功能,尤为是那些涉及UGC内容的站点。 对敏感词过滤流行的方案是基于Double-array trie tree,更复杂的采用了“多模式匹配算法”,只不过Double-array trie tree性能已经足以知足项目须要,所以找了一个基于Double-array trie tree算法的开源项目知足项目目前须要。 大部分的Double-array trie tree项目都采用了 libdatrie http://linux.thai.net/~thep/datrie/datrie.htmlphp

操做系统:CentOS

1. 安装libevent

http://monkey.org/~provos/libevent/html

# 未安装执行
yum install libevent.x86_64  libevent-devel.x86_64 libevent.i686  libevent-devel.i686

二、安装libiconv

因为libdatrie依赖于libiconv来实现编码转换,所以必须安装libiconvlinux

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
tar zxvf libiconv-1.15.tar.gz
cd libiconv-1.15
./configure
make
make install

2.安装libdatrie http://linux.thai.net/~thep/datrie/datrie.html算法

wget  ftp://linux.thai.net/pub/ThaiLinux/software/libthai/libdatrie-0.2.12.tar.xz
tar xvJf  libdatrie-0.2.12.tar.xz
cd libdatrie-0.2.12
./configure CFLAGS=-liconv
make
make install

参照 http://blog.sina.com.cn/s/blog_5921b17e010168xu.htmlphp-fpm

php-fpm多版本支持 https://blog.csdn.net/zhangfeng1133/article/details/78149653性能

相关文章
相关标签/搜索