【发布时间】:2017-03-17 06:35:50
【问题描述】:
为解决按浏览器返回键返回,关闭session后不要求输入数据后不会重新开始的问题,添加如下代码。
$this->output->set_header('Last-Modified:' . gmdate('D, d M Y H:i:s') . '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', false);
$this->output->set_header('Pragma: no-cache');
但是当我按下浏览器的后退按钮时,我收到消息确认表单重新提交。 对不起我的英语不好
【问题讨论】:
-
我应该在哪里放置:$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate, no-transform, max-age=0, post -检查=0,预检查=0"); $this->output->set_header("Pragma: no-cache");
-
在您提交表单的控制器中。请注意,标头必须首先发送。
-
放置在我的类的构造函数中,当我按下返回按钮时出现确认表单重新提交:/
-
最好的选择是redirecting (302) 通过 POST 提交表单后的 action 页面。在这里查看更多信息:stackoverflow.com/questions/3923904/…
-
非常感谢你的朋友,在你的帮助下我可以解决我的问题 :D
标签: codeigniter session caching logout back