首先是一个例子,我们可以这样做
framework:
form: true
csrf_protection: false
(看看csrf_protection)
或者在 formType 中设置它(但如果我们不想在我们拥有的所有表单中这样做,那么在配置中更好)
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Eve\CommonBundle\Form\Entity\formLogin',
'required' => false,
//'csrf_protection' => false
));
}
我的选择是在 config.yml 中声明它。现在,这是一个例子,问题是......
在 FormType 我们有诸如
'required' => false // disabling html5 check to test POST types
我如何在 config.yml 中设置它?
ps:如果我将它设置为与'csrf_protection'相同的方式它不起作用