Symfony 3.3.6 请求参数
Symfony 3.3.6 request parameters
当我 dump($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???
试试这个:
$request->request->get('form')['phone']
当我 dump($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???
试试这个:
$request->request->get('form')['phone']