Check if in “dev” mode inside a Controller with Symfony

后端 未结 9 2155
無奈伤痛
無奈伤痛 2021-01-01 08:56

When using dev mode with a Symfony2.x application, one usually works in locale. Hence, such function does not works as expected (for instance, try to get th

9条回答
  •  北海茫月
    2021-01-01 09:07

    As of Symfony 2.5 it could be done as:

    $this->container->get('kernel')->getEnvironment();
    

    Directly asking Kernel of it's environment looks nicer than searching for parameter.

提交回复
热议问题