如何在Symfony中使用过滤器操作?

How can I use filter action from page that not contain filter form (e.g. by submit or GET request)?

When I pass parameters in the following URL

<module_name>/filter/action?module_filters[_csrf_token]=62a17afab45d56382974f9a495abee7c&module_filters[id]=3998

I get an error in filter form:

csrf token: CSRF attack detected.

or

<module_name>/filter/action?module_filters[id]=3998

csrf token Required

When I execute

$filters -> disableCSRFProtection()

in my template, nothing happens.

I think you should be able to do this your template with:

$form->disableCSRFProtection();

Or you can disable CSRF in your form class with this:

$this->disableLocalCSRFProtection();

Or you can render it as part of your form in your template with this:

$form['_csrf_token']->render();

Hope that helps.