PbootCMS网站修改CSS样式后自动更新缓存

  1. 增加自动时间版本号方法

    • 文件路径:apps/common/function.php
    • 添加方法:
      php
       
      function ver($url) { $ver = filemtime($_SERVER['DOCUMENT_ROOT'].$url); echo $url.'?v='.date("YmdHis", $ver); }
  2. 修改样式链接

    • 原有调用:
      html
       
      <link rel="stylesheet" href="{pboot:sitetplpath}/css/common.css">
    • 修改后:
      html
       
      <link rel="stylesheet" href="{php}ver('/template/default/css/common.css');{/php}">

 

posted @ 2024-11-13 08:42  黄文Rex  阅读(19)  评论(0)    收藏  举报