How to get the request parameters in Symfony 2?

后端 未结 16 1586
Happy的楠姐
Happy的楠姐 2020-12-02 05:02

I am very new to symfony. In other languages like java and others I can use request.getParameter(\'parmeter name\') to get the value.

Is there anything

16条回答
  •  囚心锁ツ
    2020-12-02 05:40

    You can do it this:

    $clientName = $request->request->get('appbundle_client')['clientName'];
    

    Sometimes, when the attributes are protected, you can not have access to get the value for the common method of access:

    (POST)

     $clientName = $request->request->get('clientName');
    

    (GET)

    $clientName = $request->query->get('clientName');
    

    (GENERIC)

    $clientName = $request->get('clientName');
    

提交回复
热议问题