Custom function solves the problem of html when intercepting characters in the introduction of empire cms

silencement
Release: 2019-11-30 13:46:11
forward
2352 people have browsed it

Custom function solves the problem of html when intercepting characters in the introduction of empire cms

My solution is as follows. I wrote a function and added it. Let’s see if it works. If there are any problems, I think it’s okay.
First go to e/class/connect Add a custom function such as NoHTML() to the .php file. You can set this as you like

The code is as follows:

//去除HTML标记 function NoHTML($string){ $string = preg_replace("']*?>.*?'si", "", $string);//去掉javascript $string = preg_replace("'<[\/\!]*?[^<>]*?>'si", "", $string); //去掉HTML标记 $string = preg_replace("'([\r\n])[\s]+'", "", $string); //去掉空白字符 $string = preg_replace("'&(quot|#34);'i", "", $string); //替换HTML实体 $string = preg_replace("'&(amp|#38);'i", "", $string); $string = preg_replace("'&(lt|#60);'i", "", $string); $string = preg_replace("'&(gt|#62);'i", "", $string); $string = preg_replace("'&(nbsp|#160);'i", "", $string); return $string; }
Copy after login

Recommended to study "Empire cms tutorial"

Then go to the list content template and modify the code

The code is as follows:

$r[smalltext]=esub(NoHTML($r[smalltext]),200,'......');$listtemp='
  • [!--title--]

    [!--smalltext--]

  • ';
    Copy after login

    The problem is solved, it is very simple.
    Because it is China For English websites, the website name needs to use a title, so it is very convenient to modify it like this.

    The above is the detailed content of Custom function solves the problem of html when intercepting characters in the introduction of empire cms. For more information, please follow other related articles on the PHP Chinese website!

    Related labels:
    source:www.word666.com/cms
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!