当我应用此代码时:
class ContactoForm extends BaseContactoForm
{
public function configure()
{
$this->addCSRFProtection(rand(1, 1000));
}
}
然后我去 action.php 一个模块:
$this->form = new ContactoForm();
该字段不会更改_csrf_token:
刷新1:
<input type="hidden" id="contacto__csrf_token" value="d6e64fcc34a99c1c90dd95eef945e564" name="contacto[_csrf_token]">
刷新2:
<input type="hidden" id="contacto__csrf_token" value="d6e64fcc34a99c1c90dd95eef945e564" name="contacto[_csrf_token]">
刷新 N:
<input type="hidden" id="contacto__csrf_token" value="d6e64fcc34a99c1c90dd95eef945e564" name="contacto[_csrf_token]">
但如果我从行动中应用它:
$this->form = new ContactoForm();
$this->form->addCSRFProtection(rand(1, 1000));
在这里如果你改变
Refresh 1:
<input type="hidden" id="contacto__csrf_token" value="22815f44f18e41947d7568c0771abda4" name="contacto[_csrf_token]">
Refresh 2:
<input type="hidden" id="contacto__csrf_token" value="38bfae0a71a79d16b39ce943658f2700" name="contacto[_csrf_token]">
Refresh 3:
<input type="hidden" id="contacto__csrf_token" value="882c989dc95e40406b28200631cffc3d" name="contacto[_csrf_token]">
在 symfony 1.2 中,它起作用了。现在在 symfony 1.4 中不起作用,请帮助我,谢谢。