PHPCMS v9过滤采集内容中的CSS样式
2018-10-25 22:28:36 来源: 评论:0 点击:
在PHPCMS v9采集内容的时候,由于采集规则的原因,可能会无法完全过滤采集目标的CSS样式,这样就会导致文章发布出来后排版错乱。本文教
在PHPCMS v9采集内容的时候,由于采集规则的原因,可能会无法完全过滤采集目标的CSS样式,这样就会导致文章发布出来后排版错乱。本文教你在后台公共函数库中添加一个函数,过滤掉采集来的CSS样式,方法如下:
1、找到phpcmslibsfunctionsglobal.func.php 打开,然后添加函数
function htmrp($str) { $str = preg_replace("/<script[^>]*>/i", "", $str); $str = preg_replace("/</script>/i", "", $str); $str = preg_replace("/<iframe[^>]*>/i"</iframe[^>, "", $str); $str = preg_replace("//i", "", $str); $str = preg_replace("/, "", $str); $str = preg_replace("//i", "", $str); $str = preg_replace("/]*>/i", "", $str); $str = preg_replace("/
2、修改当前模板中文章内容页模板show.html
界面—模板风格—详情列表—content—show.html
找到
{if $allow_visitor==1} {$content}
修改为
{htmrp($content)}
3、更新缓存,刷新即可。
分享到:
收藏

评论排行
- ·office2016简体中文版下...(3)
- ·织梦仿模板堂网站模板ded...(1)
- ·微信定制游戏开发HTML5游...(1)
- ·网站是怎么架设成功的(1)