What the idea behind environment folders in Yii2 and how to use it?

前端 未结 2 2048
Happy的楠姐
Happy的楠姐 2021-02-19 08:53

I\'ve read through Yii2 documentation several times. I also googled and I couldn\'t find anything useful yet.

The problem is I do not understand the concept of the envi

2条回答
  •  遥遥无期
    2021-02-19 09:19

    First of all you don't need to put controllers and views in environment folder. environment folder contains files that contain different configuration for different environments.

    For example in frontend/web/index.php file you would want to set YII_ENVto prodwhile in production environment and to devwhile in development environment. In environmentfolder this file is already available with those specific settings in specific folders.

    So as explained Here, all you need to do is run the initcommand and choose your environment and it will put environment specific files in their proper location.

提交回复
热议问题