代码点火器&;篝火形式的值是';t在刷新时清除


Codeigniter&Bonfire form values aren't cleared on refresh

使用CI&如果我在表单的Bonfire设置输入字段中键入内容,然后刷新页面,则在页面刷新时不会清除这些字段。只有当我手动点击URL栏或重新启动浏览器时,它们才会改变。这变得很麻烦,因为我需要通过控制器在每次刷新时用新值填充表单。

这可能是因为在视图中缓存表单,但我不知道在哪里关闭它?

图片:http://shrani.si/f/R/A9/266TebkQ/untitled.png

您可以在输出最终渲染显示之前手动设置服务器标头。它也将解决缓存问题。

您可以设置到构造函数中。

$this->output->set_header("HTTP/1.0 200 OK");
$this->output->set_header("HTTP/1.1 200 OK");
$this->output->set_header('Last-Modified: '.gmdate('D, d M Y H:i:s', $last_update).' 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");
$this->output->set_header("Pragma: no-cache");