优选主流主机商
任何主机均需规范使用

PHPCMS v9高效去除采集内容CSS样式技巧详解

方法如下:

1、找到\phpcms\libs\functions\global.func.php 打开,然后添加函数

代码如下:

function htmrp($str) {

$str = preg_replace(“/<script[^>]*>/i”, “”, $str);

$str = preg_replace(“/<\/script>/i”, “”, $str);

$str = preg_replace(“/<iframe[^>]*>/i”, “”, $str);

$str = preg_replace(“/<\/iframe>/i”, “”, $str);

$str = preg_replace(“/<style[^>]*>/i”, “”, $str);

$str = preg_replace(“/<\/style>/i”, “”, $str);

$str = preg_replace(“/<div[^>]*>/i”, “”, $str);

$str = preg_replace(“/<\/div>/i”, “”, $str);

return $str;

}

2、修改当前模板中文章内容页模板show.html

界面—模板风格—详情列表—content—show.html

找到

{if $allow_visitor==1}
{$content}

修改为
代码如下:

{if $allow_visitor==1}

{htmrp($content)}

3、更新缓存,刷新即可。

未经允许不得转载:搬瓦工中文网 » PHPCMS v9高效去除采集内容CSS样式技巧详解