2009-05-05 19:59
浏览 47


My designer noticed that in the source for a drupal site, all the .css files were getting appended a ?1 that he was concerned would break things. Why is it doing this?

<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" />

图片转代码服务由CSDN问答提供 功能建议

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

 &lt; link type =“text / css”rel =“stylesheet”media =“all”href =“/ modules / modules / node /  node.css?l“/&gt; 
&lt; link type =”text / css“rel =”stylesheet“media =”all“href =”/ modules / modules / system / defaults.css?l“/&gt; \  n&lt; link type =“text / css”rel =“stylesheet”media =“all”href =“/ modules / modules / system / system.css?l”/&gt; 
&lt; link type =“text / css”  rel =“stylesheet”media =“all”href =“/ modules / modules / system / system-menus.css?l”/&gt; 
&lt; link type =“text / css”rel =“stylesheet”media =“ 所有“href =”/ modules / modules / user / user.css?l“/&gt; 
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • douchao1864 2009-05-05 20:01

    I poked around in the source code for drupal and found this:

    // 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);

    I guess that answers that. I'm going to assume since the drupal guys are doing this that browsers are cool with query strings in css link tags, even though my designer was paranoid over it.

    Hopefully this helps somebody one Google on day =p

    点赞 打赏 评论
  • dongxiejie9387 2009-05-05 20:09

    Following blog post explains this practice too: mod_expires and Cache Killers

    点赞 打赏 评论

相关推荐 更多相似问题