我有以下问题.
我在CakePHP编码,我是新手.我经常需要更改网站上的一些图像或CSS文件.在网站上我总是看到旧内容,除非我手动按下键盘上的"F5".我必须在使用该网站的每个工作场所都这样做.
这很刺激,特别是因为我不知道在哪里可以找到它的解决方案.我删除了tmp文件和cookie.什么都没有帮助,我不知道如何解决它.
请你帮助我好吗?
Cos*_*sta 17
对于\ webroot下的任何内容,请参阅Asset.timestamp
core.php中的设置:
/**
* 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);
Run Code Online (Sandbox Code Playgroud)
对于这个工作,你必须使用的蛋糕助手创建资产(如$this->Html->image()
,$this->Html->css()
等)