我有一台服务器机器,我试图允许我的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迁移.
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
原文链接:https://www.f2er.com/php/132028.htmlhttp://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';}
'modules' => [ 'gii' => [ 'class' => 'yii\gii\Module','192.168.1.*','XXX.XXX.XXX.XXX'] // adjust this to your needs ],