简体   繁体   English

codeigniter中的浏览器缓存问题

[英]Browser Cache issue in codeigniter

I am new in code igniter.I created a login form and a logout section. 我是代码igniter的新手。我创建了一个登录表单和一个注销部分。 When i press the logout section, the page will redirect to login section. 当我按下注销部分时,页面将重定向到登录部分。 And when i click the back button in the browser it will show the previous pages.When i click the clear recent history and the choose cache,and then press the back button, it will not show the recent pages.It only shows the login section. 当我单击浏览器中的后退按钮时,它将显示之前的页面。当我单击清除最近的历史记录和选择缓存,然后按后退按钮时,它将不会显示最近的页面。它只显示登录部分。 How to overcome this?Please help me... 怎么克服这个?请帮帮我...

In the .htaccess file please add the lines: 在.htaccess文件中,请添加以下行:

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

this .htaccess file should be out side of the application folder. 这个.htaccess文件应该在应用程序文件夹的一边。 So if you logout your site ie if you destroy all the session then no data be stored in the store. 因此,如果您注销您的网站,即如果您销毁所有会话,则不会在商店中存储任何数据。 So by clicking the back button in the 所以通过单击中的后退按钮

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

header() header()函数

I would add this 我想补充一点

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

to the beginning of pages where the user is logged in. 到用户登录页面的开头。

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

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