How to get request type (master/sub) in Symfony2 controller?

前端 未结 3 834
梦如初夏
梦如初夏 2021-02-19 17:23

Is there possible get request type in controller? How?

3条回答
  •  故里飘歌
    2021-02-19 17:57

    Easy, just call the getMethod() method on your Request object:

    $method = $this->get('request')->getMethod();
    

    This will return the HTTP method of the current request, e.g. GET, POST, PUT or DELETE.

提交回复
热议问题