Home PHP Libraries Other libraries PHP sensitive word filtering class
PHP sensitive word filtering class

<?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:


Disclaimer

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

PHP sensitive word filtering advanced version PHP sensitive word filtering advanced version

10 Nov 2016

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. ...

PHP sensitive word filtering PHP sensitive word filtering

25 Jul 2016

PHP sensitive word filtering

PHP sensitive word filtering code PHP sensitive word filtering code

25 Jul 2016

PHP sensitive word filtering code

PHP form filtering: sensitive word filtering and replacement PHP form filtering: sensitive word filtering and replacement

09 Aug 2023

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.

Java implements sensitive word filtering code Java implements sensitive word filtering code

10 Nov 2016

Java implements sensitive word filtering code sharing

PHP form sensitive character filtering class, PHP form filtering_PHP tutorial PHP form sensitive character filtering class, PHP form filtering_PHP tutorial

13 Jul 2016

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

See all articles