修改 app\config\main-local.php 文件即可:
1$config = [ 2 'components' => [ 3 'request' => [ 4 // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 5 'cookieValidationKey' => 'UWWauIS1-qTAJUUTavkwkJSRC9gjF5oM', 6 ] 7 ], 8]; 9 10if (!YII_ENV_TEST) { 11 // configuration adjustments for 'dev' environment 12 $config['bootstrap'][] = 'debug'; 13 $config['modules']['debug'] = [ 14 'class' => 'yii\debug\Module', 15 'allowedIPs' => ['127.0.0.1', '::1', '192.168.1.*'] //Debug 工具栏出现403禁止访问按需调整这里 16 ]; 17 18 $config['bootstrap'][] = 'gii'; 19 $config['modules']['gii'] = [ 20 'class' => 'yii\gii\Module', 21 'allowedIPs' => ['127.0.0.1', '::1', '192.168.1.*'] // GII访问出现403禁止访问按需调整这里 22 ]; 23} 24 25return $config;