获得codeigniter CSRF令牌没有一种形式?令牌、形式、codeigniter、CSRF

由网友(嘘,我的伤刚刚睡着)分享简介:我有我的网站上启用了CSRF保护,但CSRF令牌被放置在一个隐藏字段的唯一时间是当 form_close()被使用。我通过AJAX发布数据需要发送的CSRF以及以prevent 500错误。I have CSRF protection enabled on my site, but the only time the...

我有我的网站上启用了CSRF保护,但CSRF令牌被放置在一个隐藏字段的唯一时间是当 form_close()被使用。我通过AJAX发布数据需要发送的CSRF以及以prevent 500错误。

I have CSRF protection enabled on my site, but the only time the CSRF token is placed in a hidden field is when form_close() is used. I am posting data via ajax and need to send the CSRF as well to prevent the 500 errors.

我觉得有一种方法来明确地嵌入CSRF令牌进入页面,但我似乎无法找到它。

I thought there was a way to explicitly embed the CSRF token into the page, but I can't seem to find it.

我怎样才能获得CSRF令牌时没有网页?

How can I get the CSRF token when there isn't a form on the page?

推荐答案

您可以通过安全等级得到CSRF标记名称和值:

You can get the CSRF token name and value via the security class:

$this->security->get_csrf_hash();
$this->security->get_csrf_token_name();
阅读全文

相关推荐

最新文章