好吧,这是个新手问题,但我到处都找不到答案。在Symfony2的控制器中,我想从我的一个表单访问POST值。在控制器中,我有:
public function indexAction()
{
$request = $this->get('request');
if ($request->getMethod() == 'POST') {
$form = $this->get('form.factory')->create(new ContactType());
$form->bindRequest($request);
if ($form->isValid()) {
$name_value = $request->request->get('name');
不幸的是,$name_value
没有返回任何内容。我做错了什么?谢谢!
https://stackoverflow.com/questions/6916324
复制相似问题