首页 > Web开发 > 详细

解决ecshop清除缓存css样式没反应问题

时间:2020-03-03 10:52:02      阅读:64      评论:0      收藏:0      [点我收藏+]

部分浏览器例如谷歌或360等双核浏览器会对商城的css样式进行缓存,导致修改了css样式文件也没有更新。ecshop模板提供解决方法,修改后效果如下:

技术分享图片

解决方法:

修改includes/init.php

找到

if (!empty($_CFG[‘stylename‘]))

{

    $smarty->assign(‘ecs_css_path‘, ‘themes/‘ . $_CFG[‘template‘] . ‘/style_‘ . $_CFG[‘stylename‘] . ‘.css‘);

}

else

{

    $smarty->assign(‘ecs_css_path‘, ‘themes/‘ . $_CFG[‘template‘] . ‘/style.css‘);

}

修改为:

if (!empty($_CFG[‘stylename‘]))

{

    $smarty->assign(‘ecs_css_path‘, ‘themes/‘ . $_CFG[‘template‘] . ‘/style_‘ . $_CFG[‘stylename‘] . ‘.css?‘.time());

}

else

{

    $smarty->assign(‘ecs_css_path‘, ‘themes/‘ . $_CFG[‘template‘] . ‘/style.css?‘.time());

}

修改后,style.css后面将自动添加时间标识,后台清除缓存都将自动更改这时间标识,达到清除浏览器对css文件的缓存作用。

这是在主机或域名没有开启云加速前提下的修改,如果开了云加速,关闭或手动清除云加速。

解决ecshop清除缓存css样式没反应问题

原文:https://www.cnblogs.com/shixiuxian/p/12400389.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!