


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("'<script[^>]*?>.*?</script>'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; }
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='<li><strong><a href="[!--titleurl--]"> [!--title--]</a></strong><p>[!--smalltext--]</p></li>';
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Mac version
God-level code editing software (SublimeText3)