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

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

    Symfony 5.1

    $this->devEnvironment = 'dev' === getenv('APP_ENV');

    I use this inside of a Symfony service. You will need to add the line APP_ENV=dev to .env.local and APP_ENV=prod to .env file. Depending on if you have a similar env setup to me

提交回复
热议问题