如何避免Codeigniter缓存 [英] How to avoid codeigniter cache

查看:78
本文介绍了如何避免Codeigniter缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在codeingiter框架中开发了一个站点。我们面临着Codeigniter缓存问题。像这样的问题

we developed a site in codeingiter framework. we are facing a issue in codeigniter cache problem. The problem like this

用户登录后,我们的标题栏信息应为Welcome Mr.xxxxx。
如果用户已注销,则标题信息应为Welcome Guest。

When user is logged in, our header bar info should be Welcome Mr.xxxxx. If user is logged out, our header info should be Welcome Guest.

此用户在注销后,标题显示注销的用户名。

Here user after logged out, the header is showing logged out user name.

同时按Ctrl + F5。

While am pressing Ctrl+F5. It will appear correctly.

我们尝试了很多。

还将数据库查询缓存设置为false $ db ['default'] ['cache_on'] = FALSE;

also set database query cache false $db['default']['cache_on'] = FALSE;

里面有一个缓存文件夹(application\cache)除index.html和.htaccess外没有缓存文件

Inside a cache folder(application\cache) there is no cache file except index.html and .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"/>

任何帮助或指向正确的方向都可以。

Any help or pointing in the right direction will be fine. Thx!

推荐答案

您是否尝试过使用CI的输出类?

Have you tried using CI's output class?

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

这篇关于如何避免Codeigniter缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆