【问题标题】:why does drupal append ?1 to my css file links为什么 drupal 将 ?1 附加到我的 css 文件链接
【发布时间】:2009-05-05 19:59:51
【问题描述】:

我的设计师注意到,在一个 drupal 站点的源代码中,所有 .css 文件都附加了一个 ?1 ,他担心这会破坏事情。为什么要这样做?

<link type="text/css" rel="stylesheet" media="all" href="/modules/modules/node/node.css?l" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/modules/system/defaults.css?l" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/modules/system/system.css?l" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/modules/system/system-menus.css?l" />
<link type="text/css" rel="stylesheet" media="all" href="/modules/modules/user/user.css?l" />

【问题讨论】:

    标签: php drupal


    【解决方案1】:

    我翻遍了drupal的源代码,发现了这个:

    // A dummy query-string is added to filenames, to gain control over
    // browser-caching. The string changes on every update or full cache
    // flush, forcing browsers to load a new copy of the files, as the
    // URL changed.
    $query_string = '?'. substr(variable_get('css_js_query_string', '0'), 0, 1);
    

    我想这可以回答这个问题。我会假设,因为 drupal 的家伙正在这样做,浏览器在 css 链接标签中使用查询字符串很酷,即使我的设计师对此很偏执。

    希望这可以帮助某人在当天使用 Google =p

    【讨论】:

      【解决方案2】:

      以下博客文章也解释了这种做法:mod_expires and Cache Killers

      【讨论】:

        猜你喜欢
        • 2017-11-22
        • 1970-01-01
        • 2022-01-25
        • 1970-01-01
        • 1970-01-01
        • 2011-10-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多