【发布时间】:2017-01-18 11:13:48
【问题描述】:
大家好,我正在使用 CodeIgniter 框架,我在注销后出现问题,会话已被破坏并重定向到登录表单,并且在重定向到登录表单后,浏览器后退按钮可以返回到仪表板但有错误因为会话已经被破坏了。我想要的只是禁用浏览器的后退按钮或我以前无法加载的任何内容。我已阅读有关此问题的其他帖子并尝试了他们的解决方案,但它不起作用。我已经根据我在构造函数的其他帖子中阅读的内容粘贴了此代码。
The code that I've seen from the post and posted in my constructor :
header("cache-Control: no-store, no-cache, must-revalidate");
header("cache-Control: post-check=0, pre-check=0", false);
// HTTP/1.0
header("Pragma: no-cache");
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
这是我的注销:
$sess_array = array(
'username' => ''
);
$this->session->unset_userdata('logged_in', $sess_array);
$this->session->sess_destroy();
redirect('auth', 'refresh');
这是来自我的仪表板:
<li>
<a href="<?= base_url('auth/logout') ?>"><i3 class="glyphicon glyphicon-off"></i3> Logout</a>
</li>
【问题讨论】:
标签: php codeigniter session