免费资源网,https://freexyz.cn/

我的解决方法如下,写了个函数加进去,大家看看是否可行,有咩有问题,我感觉还行

首先在 e/class/connect.php 文件中加入一个自定义函数 比如 NoHTML() 这个自己喜欢随便设置

//去除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;
}

然后去列表内容模板修改代码即可

$r[smalltext]=esub(NoHTML($r[smalltext]),200,'......');
$listtemp='<li><strong><a href="[!--titleurl--]">[!--title--]</a></strong><p>[!--smalltext--]</p></li>';

这样问题就解决了,很简单吧.

免费资源网,https://freexyz.cn/


帝国cmsHTML

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。