2011-03-25 111 views
3

我是新代码igniter.I中创建了一个登录表单和一个注销部分。当我按下注销部分时,页面将重定向到登录部分。当我点击浏览器中的后退按钮时,它会显示前面的页面。当我点击清除最近的历史记录和选择缓存,然后按后退按钮,它不会显示最近pages.It只显示登录部分。如何克服呢?请帮我...codeigniter中的浏览器缓存问题

回答

1

header()

我想补充一点

header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past 

到用户所登录的页面开始。

+0

仍包含相同的问题。我的登录页面login_page.php.Aftter登录我已设置会话,然后重定向到index.php page.I将您的代码放入这两个文件中。但它没有得到工作。 – 2011-03-25 08:51:02

+2

嗨,我得到了一个解决方案....将以下语句添加到每个控制器构造函数,除了登录页面构造函数。 ........ $ this-> output-> set_header(“Cache-Control:no-store,no-cache,must-revalidate,no-transform,max-age = 0,post-check = 0,预检查= 0" ); $ this-> output-> set_header(“Pragma:no-cache”); – 2011-03-25 10:06:37

+0

很高兴你找到了适合你的版本=) – Shad 2011-03-25 14:41:01

2
$this->output->set_header('Pragma: no-cache'); 
$this->output->set_header('Cache-Control: no-cache, must-revalidate'); 
$this->output->set_header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 
4

在.htaccess文件中请添加行:

<IfModule mod_headers.c> 
Header add Cache-Control: "no-store, no-cache, must-revalidate" 
</IfModule> 

这个.htaccess文件应该在应用程序文件夹的外面。因此,如果您注销您的网站,即如果您销毁了所有会话,则不会在商店中存储任何数据。所以通过点击后退按钮