Cakephp 我应该在哪里调用CakerResponse::disableCache()?

Cakephp 我应该在哪里调用CakerResponse::disableCache()?,cakephp,Cakephp,我一直在愉快地调用CakeResponse::disableCache()来禁用浏览器缓存,据我所知,它工作得很好 然而,自从升级到PHP5.4之后,我得到了以下严格的警告: Strict (2048): Non-static method CakeResponse::disableCache() should not be called statically, assuming $this from incompatible context [APP/Controller/AppContr

我一直在愉快地调用
CakeResponse::disableCache()AppController.php
beforeFilter()
中选择code>来禁用浏览器缓存,据我所知,它工作得很好

然而,自从升级到PHP5.4之后,我得到了以下严格的警告:

Strict (2048): Non-static method CakeResponse::disableCache() 
should not be called statically, assuming $this from incompatible 
context [APP/Controller/AppController.php, line 53]
该函数似乎仍在工作,但错误告诉我,我误解了一些非常基本的东西,可能有一种不同(更好)的方法来实现它


因此,如果我需要在应用程序范围内禁用浏览器缓存(即:
无存储、无缓存、必须重新验证
等),那么在Cake 2.3中实现这一点的最佳方法是什么?

为什么不访问CakerResponse对象?它是如何在OOP上下文中使用的?作为控制器的一部分:

$this->response
因此,在你的情况下:

$this->response->disableCache();
在类似文档的文档中也有很多例子

在提问之前你读过这本书吗