在PHPCMS v9采集内容的时候,由于采集规则的原因,可能会无法完全过滤采集目标的CSS样式,这样就会导致文章发布出来后排版错乱。本文教你在后台公共函数库中添加一个函数,过滤掉采集来的CSS样式,方法如下:
1、找到\phpcms\libs\functions\global.func.php 打开,然后添加函数function htmrp($str) {
$str = preg_replace("/
$str = preg_replace("/<\/script>/i", "", $str);
$str = preg_replace("/]*>/i", "", $str);
$str = preg_replace("/<\/iframe>/i", "", $str);
$str = preg_replace("/
$str = preg_replace("/<\/style>/i", "", $str);
$str = preg_replace("/
$str = preg_replace("/<\/div>/i", "", $str);
return $str;
}
2、修改当前模板中文章内容页模板show.html
界面—模板风格—详情列表—content—show.html
找到{if $allow_visitor==1}
{$content}
修改为{htmrp($content)}
3、更新缓存,刷新即可。
软件大小:8.04MB
软件类别:国产软件 | CMS建站
软件语言:简体中文
运行环境:PHP/Mysql
软件授权:免费版
更新时间:2015-12-28 10:33:57