【问题标题】:Confirm Form Resubmission pressing the back button after the closing session (logout)关闭会话后按返回按钮确认重新提交表单(注销)
【发布时间】: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


【解决方案1】:
    $this->output->set_header('Last-Modified:' . gmdate('D, d M Y H:i:s') . 'GMT');
    $this->output->set_header('Cache-Control: no-cache, no-cache, must-revalidate');
    $this->output->set_header('Cache-Control: post-check=0, pre-check=0', false);
    $this->output->set_header('Pragma: no-cache');

【讨论】:

    猜你喜欢
    • 2015-07-01
    • 1970-01-01
    • 2018-02-21
    • 2011-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-09
    • 2013-06-06
    相关资源
    最近更新 更多