我们在codeingter框架中开发了一个站点。我们正面临一个代码点火器缓存问题。像这样的问题
当用户登录时,我们的标题栏信息应该是欢迎xxxxx先生。如果用户已注销,我们的标题信息应为"欢迎客人"。
这里的user在注销后,表头显示的是注销的用户名。
同时按Ctrl+F5。它将正确显示。
我们尝试了很多。
还将数据库查询缓存设置为假$db['default']['cache_on'] = FALSE;
在缓存文件夹(application''cache)中,除了index.html和.htaccess 之外,没有缓存文件
输出缓存也是$this->output->cache(0);
。
我也试过这个。
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
任何帮助或指向正确的方向都可以。Thx!
您尝试过使用CI的输出类吗?
http://www.codeigniter.com/userguide3/libraries/output.html#CI_Output::set_header
$this->output->set_header('HTTP/1.0 200 OK');
$this->output->set_header('HTTP/1.1 200 OK');
$this->output->set_header('Last-Modified: '.gmdate('D, d M Y H:i:s', $last_update).' GMT');
$this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate');
$this->output->set_header('Cache-Control: post-check=0, pre-check=0');
$this->output->set_header('Pragma: no-cache');