How to render CSRF input in twig?

前端 未结 5 1662
野性不改
野性不改 2021-02-02 06:39

I know there\'s the usual way to render CSRF token hidden input with form_rest, but is there a way to render just CSRF input itself? I\'ve overridd

5条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-02 07:12

    Or you can just simply use this :

    {{ form_row(form._token) }}
    

    This will automatically generate the proper hidden HTML elements, ie the proper HTML structure and field names, according to the type of form you're using.

提交回复
热议问题