CI 中的 POST 数据中未定义 CSRF 令牌值

CSRF token value isn't defined in POST data in CI

在查看源代码中我有以下代码

<form action="http://localhost/working/codeigniter/index.php/test.html" method="post" accept-charset="utf-8">
    <input type="hidden" name="csrf_test_name"    value="e44f21e60b55e940f05626b3b7b01fcb" />
    <input type="text" name="name" value="" />
    <input type="submit" name="submit" value="Submit" />
</form>

但是$data = $this->input->post();没有给我 csrf_test_name 价值。

安全 class。

从 post 数据中删除了 CSRF 令牌

然后一切都是自动的:如果启用了 $config['csrf_protection'],它将通过输入 class 和 return 验证,如果令牌没有匹配。