GII 和 DEBUG 模块出现 403 解决

修改 app\config\main-local.php 文件即可:

$config = [
    'components' => [
        'request' => [
            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
            'cookieValidationKey' => 'UWWauIS1-qTAJUUTavkwkJSRC9gjF5oM',
        ]
    ],
];
 
if (!YII_ENV_TEST) {
    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = [
        'class' => 'yii\debug\Module',
        'allowedIPs' => ['127.0.0.1', '::1', '192.168.1.*'] //Debug 工具栏出现403禁止访问按需调整这里
    ];
 
    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = [
        'class' => 'yii\gii\Module',
        'allowedIPs' => ['127.0.0.1', '::1', '192.168.1.*'] // GII访问出现403禁止访问按需调整这里
    ];
}
 
return $config;

评论

暂无评论