Yii初始化环境配置
1.入口文件添加
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING); defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_ENV') or define('YII_ENV', 'dev');
2.gii,debug模块
在admin/config/main-local.php 追加代码
if (YII_ENV_DEV) { // configuration adjustments for 'dev' environment $config['bootstrap'][] = 'debug'; $config['modules']['debug'] = [ 'class' => \yii\debug\Module::class, 'panels' => [ 'queue' => \yii\queue\debug\Panel::class, ], ]; $config['bootstrap'][] = 'gii'; $config['modules']['gii'] = [ 'class' => 'yii\gii\Module', 'allowedIPs' => ['127.0.0.1', '::1', '192.168.*.*'], ]; }