如何强制刷新图像& css文件在CakePHP? [英] How to force refresh of images & css files in CakePHP?

查看:146
本文介绍了如何强制刷新图像& css文件在CakePHP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题。

我在CakePHP中编码,我是新手。我经常需要更改网站上的一些图像或CSS文件。在网站上,我总是看到旧的内容,除非我手动按F5键盘上。我必须在使用该网站的每个工作场所都这样做。

I'm coding in CakePHP and I'm a novice. I quite often need to change some images or css files on the website. And on the website I always see the old content unless I manually press "F5" on the keyboard. And I have to do it on every workplace that uses that website.

这是很刺激,特别是因为我不知道在哪里可以找到它的解决方案。我删除了tmp文件和cookie。没有任何帮助,我不知道该如何解决。

It is irritating especially because I don't know where I can find the solution for it. I removed tmp files and cookies. Nothing helps and I don't know how can I fix it.

你能帮我吗?

推荐答案

对于\webroot下的任何内容,请参阅 Asset.timestamp 在core.php中设置:

For anything under \webroot, see the Asset.timestamp setting in 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);



为此,您必须使用Cake helpers资源(例如 $ this-> Html-> image() $ this-> Html-> css code>,etc)


For this to work, you have to use the Cake helpers to create the assets (e.g. $this->Html->image(), $this->Html->css(), etc)

这篇关于如何强制刷新图像& css文件在CakePHP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆