简体   繁体   English

如何避免codeigniter缓存

[英]How to avoid codeigniter cache

we developed a site in codeingiter framework. 我们在codeingiter框架中开发了一个站点。 we are facing a issue in codeigniter cache problem. 我们在codeigniter缓存问题中面临一个问题。 The problem like this 像这样的问题

When user is logged in, our header bar info should be Welcome Mr.xxxxx. 用户登录后,我们的标题栏信息应为Welcome Mr.xxxxx。 If user is logged out, our header info should be Welcome Guest. 如果用户已注销,我们的标题信息应为Welcome Guest。

Here user after logged out, the header is showing logged out user name. 这里用户注销后,标题显示已注销的用户名。

While am pressing Ctrl+F5. 在按Ctrl + F5的同时。 It will appear correctly. 它会正确显示。

We tried a lot. 我们尝试了很多。

also set database query cache false $db['default']['cache_on'] = FALSE; 还设置数据库查询缓存false $db['default']['cache_on'] = FALSE;

Inside a cache folder(application\\cache) there is no cache file except index.html and .htaccess 在缓存文件夹(application \\ cache)中,除了index.html和.htaccess之外没有缓存文件

The output cache also be $this->output->cache(0); 输出缓存也为$this->output->cache(0); .

And Also tried this one. 并尝试了这一个。

<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"/>

Any help or pointing in the right direction will be fine. 任何帮助或指向正确的方向都没问题。 Thx! 谢谢!

Have you tried using CI's output class? 您是否尝试过使用CI的输出类?

http://www.codeigniter.com/userguide3/libraries/output.html#CI_Output::set_header 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');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM