Home
Sign Up
Sign In
V2EX
›
PHP
有啥现成的关键词替换函数轮子?
cnqncom
·
Oct 8, 2017
· 2639 views
This topic created in 3210 days ago, the information mentioned may be changed or developed.
成块的用户提交上来的内容(文字内容+HTML 标签),需要对里面的内容进行关键词替换过滤处理。后台有一堆关键词库,数组形式存在。求一个好用的关键词替换函数轮子,需要注意的问题:
1.替换效率(关键词库里有很多词)
2.中文字符串乱码的问题
3.HTML 危险标签处理
替换
词库
函数
关键词
5 replies
•
2017-10-09 11:30:36 +08:00
1
owt5008137
Oct 8, 2017
C++的倒是有一个,还可以导出 dot 图:
.h
https://github.com/atframework/atframe_utils/blob/master/include/string/ac_automation.h
test
https://github.com/atframework/atframe_utils/blob/master/test/case/ac_automation_test.cpp
2
cnqncom
OP
Oct 9, 2017
谢谢楼上的,我需要的是 PHP
3
holajamc
Oct 9, 2017
https://github.com/luicfer/AhoCorasick
ac 自动机呗
4
cnqncom
OP
Oct 9, 2017
@
holajamc
感谢
5
holajamc
Oct 9, 2017
@
cnqncom
还是推荐一楼哥们的,php 应该有办法调用 cpp 或者 c,这种东西还是它们写的比较好
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Solana
·
4515 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 42ms ·
UTC 09:56
·
PVG 17:56
·
LAX 02:56
·
JFK 05:56
♥ Do have faith in what you're doing.
❯