php – Yii2 Gii禁止代码403您不能访问此页面

前端之家收集整理的这篇文章主要介绍了php – Yii2 Gii禁止代码403您不能访问此页面前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一台服务器机器,我试图允许我的PC IP地址使用gii.

我的电脑ip地址是192.168.1.101

服务器机器ip是192.168.1.102.

我使用composer来安装gii模块.

这是我的composer.json设置如何:

"require": {
        "PHP": ">=5.4.0","yiisoft/yii2": "*","yiisoft/yii2-bootstrap": "*","yiisoft/yii2-swiftmailer": "*","yiisoft/yii2-gii": "*"
    },"require-dev": {
        "yiisoft/yii2-codeception": "*","yiisoft/yii2-debug": "*","yiisoft/yii2-gii": "*","yiisoft/yii2-faker": "*"
    },

我已经使用PHP init和composer update和PHP yii迁移.

我也在前台登录.

这是main.PHP文件内容

return [
    'id' => 'app-frontend','basePath' => dirname(__DIR__),'bootstrap' => ['gii'],'controllerNamespace' => 'frontend\controllers','components' => [
        'user' => [
            'identityClass' => 'common\models\User','enableAutoLogin' => true,],'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,'targets' => [
                [
                    'class' => 'yii\log\FileTarget','levels' => ['error','warning'],'errorHandler' => [
            'errorAction' => 'site/error','params' => $params,'modules' => [
        'gii' => [
            'class' => 'yii\gii\Module','allowedIPs' => ['127.0.0.1','::1','192.168.1.101'],'password' => '123456'
        ],];
我有一个类似的问题,尝试所有不同的ipFilter更改.最后我需要添加到main-local.PHP.这是奇怪的,因为我有一个高级应用程序,并且设置是一个“yii2基本”设置.
http://www.yiiframework.com/doc-2.0/guide-start-gii.html
if (!YII_ENV_TEST) {
// configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = 'yii\debug\Module';

$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = 'yii\gii\Module';}

我也应该指出,我把它添加到main.PHP

'modules' => [
    'gii' => [
        'class' => 'yii\gii\Module','192.168.1.*','XXX.XXX.XXX.XXX'] // adjust this to your needs
    ],
原文链接:https://www.f2er.com/php/132028.html

猜你在找的PHP相关文章