Yii disable http cache

How to disable http cache on Yii? The browser cannot refresh the view until I manually refresh the browser.

Are there some kind of cakephp disableCache ()?

+3
source share
2 answers

CakePHP function does

$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'
));

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 name it if necessary.

+1
source

Check your filter () inside the controller and / or base controller (if you use it). It should have something like "CHttpCacheFilter", just delete it. By default, HttpCache is not enabled.

More details: http://www.yiiframework.com/doc/guide/1.1/nl/caching.page#http-caching

CHttpCacheFilter, .htaccess, , http.

0

All Articles