[英]Yii disable http cache
How can I disable the http cache on Yii? 如何在Yii上禁用http缓存? The browser can't update the view, until I refresh the browser manually.
在我手动刷新浏览器之前,浏览器无法更新视图。
Is there some like cakephp disableCache()? 有没有像cakephp disableCache()?
CakePHP's function does CakePHP的功能确实如此
$this->header(array(
'Expires' => 'Mon, 26 Jul 1997 05:00:00 GMT',
'Last-Modified' => gmdate("D, d M Y H:i:s") . " GMT",
'Cache-Control' => 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0'
));
so maybe you can make a function with: 所以也许你可以用:
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
and call it when needed. 并在需要时调用它。
Check your filters() method inside your controller and/or base controller (if you're using it). 检查控制器和/或基本控制器内的filters()方法(如果您正在使用它)。 There should be something like 'CHttpCacheFilter' in it, just remove that.
应该有类似'CHttpCacheFilter'的东西,只需删除它。 By default HttpCache isn't enabled.
默认情况下,未启用HttpCache。
More details: http://www.yiiframework.com/doc/guide/1.1/nl/caching.page#http-caching 更多细节: http : //www.yiiframework.com/doc/guide/1.1/nl/caching.page#http-caching
If you don't use the CHttpCacheFilter, check your .htaccess file, perhaps there is some http caching done as well. 如果你不使用CHttpCacheFilter,请检查.htaccess文件,也许还有一些http缓存。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.