<?php class Logic_BlackWord { const APP_FORUM = 1; const APP_BLOG = 2; const APP_VOTE = 3; public function getHitList($txt) { $hitList = array(); //对禁词分批过滤 $max = $this->getMax(); if($max) { $size = 1000; $last = ceil($max/$size); for($page=1;$page<=$last;$page++) { $result = $this->getHitListByPage($txt,$page,$size); if($result) $hitList = array_merge($hitList,$result); } }
主要使用了 int substr_count ( string haystack, string needle [, int offset [, int length]] ) 这个方法,这个方法遍历待测的字符串$str中有没有$allergicWord数组中所包含的敏感词:
本站所有资源均由网友贡献或各大下载网站转载。请自行检查软件的完整性!本站所有资源仅供学习参考。请不要将它们用于商业目的。否则,一切后果由您负责!如有侵权,请联系我们删除。联系方式:admin@php.cn
相关文章

04Nov2024
使用 PHP 过滤数组值(如 SQL LIKE '%search%')使用 JQueryUI 实现自动完成功能,从...检索字母匹配项

03Nov2024
使用 SQL LIKE '%search%' 从数组中过滤值在 PHP 中根据与指定匹配的用户输入过滤数组中的值...

04Nov2024
在 PHP 中使用类似 SQL 的“%search%”查询过滤数组值当使用 JQueryUI 构造自动完成字段时,检索特定结果...

21Nov2024
解决 UnsatisfiedLinkError: Can't Find Dependent Libraries in JNI Projects当开发 Java Native Interface (JNI) 项目时,您可能...

30Oct2019
phpmyadmin不显示登录页面解决方法:找到并打开phpMyAdmin\libraries\plugins\auth\AuthenticationCookie.class.php文件,将其中关于登录页面代码中的两处hide删除即可。

20Oct2024
phpMyAdmin 错误:“count():参数必须是实现可数的数组或对象”您是否遇到过 phpMyAdmin 错误,指出“./libraries/sql.lib.php#601\ncount() 中的警告:参数必须是数组或对象


Hot Tools
