Symfony 3.3.6请求参数

时间:2017-08-13 18:48:14

标签: symfony symfony-forms

我可以看到当我转储($ request-> request)

时填充参数
ParameterBag {#69 ▼
  #parameters: array:1 [▼
    "form" => array:8 [▼
      "phone" => "2042333233"
      "price" => "72"
      "region" => "1"
      "accept_terms" => "1"
      "_token" => "XXX"
    ]
  ]
}

但是当我尝试访问参数时:

$request->get('phone')
$request->request->get('phone')

请求是从POST填充的 - 所以后者应该可以工作,但结果是NULL ???

1 个答案:

答案 0 :(得分:0)

试试这个:

$request->request->get('form')['phone']