douguazhi5966 2013-10-23 21:41
浏览 64

WAMP + PHP CSS包括不会更新新样式

I am stumped. I am using includes to import a style sheet. If I add a new style to the style sheet, generated pages will not display ANY of the new css. If I change an old css rule it WILL display the change. I thought it might be a cached file of some kind, but I have cleared the cache in all testing browsers and the problem persists.

At first I thought it was a WAMP issue, but the problem happens when I move it all live as well so now I am thinking I am doing something wrong with the includes....

<link rel="stylesheet" type="text/css" href="css/foundation.css">
<!-- Included Custom Overides -->
<link rel="stylesheet" type="text/css" href="css/Custon_Foundation_Overides.css">
<!-- Supersizer CSS -->

And this is simply my include...

<?php require("Includes/HEADER.php"); ?>

Again, all the old CSS works fine, just any new additions to any of the style sheets will not display.

Thanks

  • 写回答

2条回答 默认 最新

  • dq_1984 2013-10-23 21:48
    关注

    Sounds like a browser cache issue. A simple way to fix this while maintaining good caching practices would be to pass the file make time as a query var to the file.

    <link rel="stylesheet" type="text/css" href="css/foundation.css?ver=<?php echo filemtime('css/foundation.css');?>">
    

    This will generate a string like:

    <link rel="stylesheet" type="text/css" href="css/foundation.css?ver=1382564850">
    

    This way when you update the file your browser will think its a new file and cache that, but as long as the file remains unchanged it will have the same name and maintain the browser cache.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度