Browser Cache issue in codeigniter

随声附和 提交于 2020-02-24 10:36:09

问题


I am new in code igniter.I created a login form and a logout section. 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...


回答1:


In the .htaccess file please add the lines:

<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. So if you logout your site i.e. if you destroy all the session then no data be stored in the store. So by clicking the back button in the




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



回答3:


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.



来源:https://stackoverflow.com/questions/5429386/browser-cache-issue-in-codeigniter

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!