【发布时间】:2018-07-31 09:37:07
【问题描述】:
我正在使用 codeigniter 3 我想在我的项目中使用 csrf 当我为 true csrf_protection 时它会显示一个错误,例如(不允许您请求的操作。)当我对 csrf_protection 执行错误时,当我创建它时该值为空ture 然后这个错误显示(您请求的操作是不允许的。)我如何使用 csrf 提前谢谢。 config.php
$config['csrf_protection'] = TRUE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array();
在我看来我正在使用这个
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>">
【问题讨论】:
-
只要使用
form_open()函数,它就会为你创建表单和隐藏输入 -
nothing word use this form_open() when use $config['csrf_protection'] = TRUE;而不是在 FALSE teken 值为空时显示错误
标签: php codeigniter