Symfony2, How to change environment?

后端 未结 2 592
执念已碎
执念已碎 2021-02-08 11:42

I have read a lot about the clear cache command for symfony2, but I have this question :

Is php app/console cache:clear --env=prod with --env,

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-08 12:05

    The two constructor arguments for Symfony\Component\HttpKernel\Kernel are $environment and $debug.

    So, to answer your question directly, app.php already uses the production environment. You'll notice that app_dev.php instantiates the kernel like this

    $kernel = new AppKernel('dev', true); 
    

    So, the environment name that you pass to the kernel constructor maps to the environment name you'd use in console commands (i.e., the --env).

    Does that clear it up for you?

提交回复
热议问题