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

后端 未结 9 2158
無奈伤痛
無奈伤痛 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:14

    In Symfony 4 and higher, you can use simply :

    if ($this->getParameter('kernel.environment') === 'dev') {
        // ...
    }
    

提交回复
热议问题