Getting all request parameters in Symfony 2

后端 未结 3 1752
梦毁少年i
梦毁少年i 2020-12-13 08:05

In symfony 2 controllers, every time I want to get a value from post I need to run:

$this->getRequest()->get(\'value1\');
$this->getRequest()->ge         


        
3条回答
  •  暖寄归人
    2020-12-13 08:42

    Since you are in a controller, We assume to you are passing parameter Request; You can access all post $request->request->all(); This returns key-value pair array; On the other when using get request you access data using $request->query->all();

提交回复
热议问题