php extension for spam word filter based on Double-Array Trie tree, it can detect if a spam word exists in a text message.php
關鍵詞過濾擴展,用於檢查一段文本中是否出現敏感詞,基於Double-Array Trie 樹實現。html
一、安裝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 && ldconfiglinux
二、安裝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 installgit
三、添加trie-filter
yum install unzip -y
wget https://github.com/wulijun/php-ext-trie-filter/archive/master.zipgithub
#php7.0.13使用 https://github.com/zzjin/php-ext-trie-filter/archive/php7.zipphp7
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便可php-fpm