我在Symfony2框架中有一个表单。成功提交页面时,它呈现另一个树枝模板文件,并通过传递数组中的参数来返回值。但提交后,如果我刷新页面,它又提交表单并创建表格条目。这里是提交在控制器后执行的代码,Symfony2表单提交页面刷新
$this->get('session')->setFlash('info', $this->get('translator')->trans('flash.marca'));
return $this->render('NewBundle:Backend:marca.html.twig', array(
'active' => 1,
'marca' => $marca,
'data' => $dataCamp,
'dataMarca' => $this->getMarcas($admin->getId()),
'admin' => $admin,
));
我想要的形式被重定向到的参数与上面提到的警告消息中提到那里的树枝文件。但我不希望表单在页面刷新时提交。
感谢
工程就像一个魅力! – Keutelvocht 2017-09-05 10:58:35