【发布时间】:2013-01-24 01:28:31
【问题描述】:
我有以下问题。
我正在使用 CakePHP 进行编码,而且我是新手。我经常需要更改网站上的一些图像或 css 文件。在网站上,我总是看到旧内容,除非我手动按键盘上的“F5”。我必须在使用该网站的每个工作场所都这样做。
这很烦人,尤其是因为我不知道在哪里可以找到解决方案。我删除了 tmp 文件和 cookie。没有任何帮助,我不知道该如何解决。
你能帮帮我吗?
【问题讨论】:
标签: cakephp
我有以下问题。
我正在使用 CakePHP 进行编码,而且我是新手。我经常需要更改网站上的一些图像或 css 文件。在网站上,我总是看到旧内容,除非我手动按键盘上的“F5”。我必须在使用该网站的每个工作场所都这样做。
这很烦人,尤其是因为我不知道在哪里可以找到解决方案。我删除了 tmp 文件和 cookie。没有任何帮助,我不知道该如何解决。
你能帮帮我吗?
【问题讨论】:
标签: cakephp
对于 \webroot 下的任何内容,请参阅 core.php 中的 Asset.timestamp 设置:
/**
* Apply timestamps with the last modified time to static assets (js, css, images).
* Will append a querystring parameter containing the time the file was modified. This is
* useful for invalidating browser caches.
*
* Set to `true` to apply timestamps when debug > 0. Set to 'force' to always enable
* timestamping regardless of debug value.
*/
Configure::write('Asset.timestamp', true);
为此,您必须使用 Cake 助手来创建资产(例如 $this->Html->image()、$this->Html->css() 等)
【讨论】: