我正在试验Symfony,我正在尝试提出一个POST请求。但我似乎无法在控制器中获取请求的POST参数。
/**
* @Route("/messages/comment/post/", methods={"POST"}, name="postComment")
*/
public function postComment($messageId, $comment)
{
$statuscode = 200;
$response = null;
try {
$response = $this->messageModel->postComment($messageId, $comment);
} catch (\PDOException $exception) {
var_dump($exception);
$statuscode = 500;
}
return new JsonResponse($response, $statuscode);
}
如何定义参数?