【发布时间】:2021-03-14 01:44:57
【问题描述】:
我可以将 CSRF 保护添加到仅在一个页面中的单个表单吗?
如果我在配置文件中创建$config['csrf_protection'] = TRUE;,则它在应用程序中全局适用,但我不想全局使用。
有什么办法可以实现吗?
我搜索了,没有找到任何解决方案。
我试过了
$config['csrf_protection'] = FALSE;
$csrf = array(
'name' => $this->security->get_csrf_token_name(),
'hash' => $this->security->get_csrf_hash()
);
<input type="hidden" name="<?=$csrf['name'];?>" value="<?=$csrf['hash'];?>" />
【问题讨论】:
-
如果您使用 Codeigniter 4,只需编辑过滤器codeigniter4.github.io/userguide/libraries/…
标签: php codeigniter