<?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); } }
Mainly uses int substr_count (string haystack, string needle [, int offset [, int length]]) This method, this method traverses whether there is $allergicWord in the string $str to be tested Sensitive words contained in the array:
All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn
Related Article
10Nov2016
We have introduced a PHP program that filters some special characters before. Let's upgrade this sensitive word filtering function to be more powerful. With it, we are no longer afraid of adding spaces or other punctuation marks in the middle of sensitive words. ...
09Aug2023
PHP form filtering: sensitive word filtering and replacement In the process of developing web applications, we often need to filter and clean the data submitted by users to protect the security of the website and the privacy of the users. Among them, filtering and replacing sensitive words is a very important task. This article will introduce how to use PHP to filter and replace sensitive words, and provide corresponding code examples. The principle of sensitive word filtering and replacement. Sensitive word filtering and replacement refers to detecting sensitive words contained in the data submitted by users and replacing them with specified words.
10Nov2016
Java implements sensitive word filtering code sharing
13Jul2016
PHP form sensitive character filtering class, PHP form filtering. PHP form sensitive character filtering class, PHP form filtering This article describes the PHP form sensitive character filtering class and its usage with examples. Share it with everyone for your reference. The specific analysis is as follows: Copy code
Hot Tools
PHP library for dependency injection containers
PHP library for dependency injection containers
A collection of 50 excellent classic PHP algorithms
Classic PHP algorithm, learn excellent ideas and expand your thinking
Small PHP library for optimizing images
Small PHP library for optimizing images