简体   繁体   English

Symfony 2 CSRF令牌发行

[英]Symfony 2 CSRF token issue

I am having some problems with one of my online projects. 我的一个在线项目遇到了一些问题。 I am getting this error: 我收到此错误:

The CSRF token is invalid. CSRF令牌无效。 Please try to resubmit the form. 请尝试重新提交表格。

on every form and i can't log-out from session. 在每种形式上,我都无法从会话中注销。 The app was working fine a few days ago so it must be something wrong with the server. 该应用程序几天前运行良好,因此服务器一定有问题。 I can't figure out what. 我不知道是什么。 The CSRF tokens are generated fine, i checked. 我检查了CSRF令牌的生成情况。 After i disabled the CSRF protection the form submitted but the flash message did not appear. 我禁用CSRF保护后,提交了表单,但没有出现Flash消息。 Anyone had this problem before? 有人遇到过这个问题吗?

Are you including the token in the form? 您是否在表单中包含令牌?

{{ form_widget(form._token) }}

Or the less clean 还是不太干净

{{ form_rest(form) }}

As for your other issue, you will have to be more specific. 至于其他问题,您将必须更加具体。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM