How to set the environment in a Symfony2 console command

后端 未结 6 1185
清歌不尽
清歌不尽 2021-01-31 14:46

Hopefully a simple question - how does one specify which environment to use when running a console command in Symfony2. I\'ve created a few commands, however I would like to run

6条回答
  •  南方客
    南方客 (楼主)
    2021-01-31 15:47

    The official documentation says:

    By default, console commands run in the dev environment and you may want to change this for some commands.

    So, as @Problematic suggest, you can specify the environment for your command using the flag "--env=your_env" or its shortcut "-e your_env".

    I wonder whether it is possible to force the default environment for a command. I mean, without having to use the flags. Any idea?

提交回复
热议问题