./init 选择dev还是production 有啥区别

问题咨询 · owen · 于 6年前 发布 · 2472 次阅读

Which environment do you want the application to be initialized in?

[0] Development [1] Production

Your choice [0-1, or "q" to quit] 1

Initialize the application under 'Production' environment? [yes|no]

开发环境和生产环境 选择的时候有啥区别 ?

共收到 3 条回复
owen#16年前 0 个赞

另外环境能否切换 比如原来是开发环境 想切换到生产环境

Fecmall#26年前 0 个赞

没有太大的区别,熟悉Yii2,你就会知道,

开发环境开启了debug的功能,也就是在页面显示报错。

如果你是develop安装的,到了线上你要切换product模式,那么,进入到 @app/web/index.php

将:

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

改成

defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');
owen#36年前 0 个赞

THANKS

添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics