一个高效的敏感词过滤方法(PHP)

2025-10-26
网站建设限时活动促销

一个高效的敏感词过滤方法(PHP) :

$badword = array( '张三','张三丰','张三丰田' ); $badword1 = array_combine($badword,array_fill(0,count($badword),'*')); $bb = '我今天开着张三丰田上班'; $str = strtr($bb, $badword1); echo $str;
$hei=array( '中国', '日本' ); $blacklist="/".implode("|",$hei)."/i"; $str="中国一是一个很好的国家"; if(preg_match($blacklist, $str, $matches)){ print "found:". $matches[0]; } else { print "not found."; }

相关文章:

利用PHP扩展trie_filter做中文敏感词过滤

php敏感词过滤使用第三方扩展trie_filter

PHP实现过滤留言信息中的敏感词

立即学习“PHP免费学习笔记(深入)”;

标签: 敏感词过滤

本文地址:https://www.lifejia.cn/news/213407.html

免责声明:本站内容仅用于学习参考,信息和图片素材来源于互联网,如内容侵权与违规,请联系我们进行删除,我们将在三个工作日内处理。联系邮箱:cloudinto#qq.com(把#换成@)