我在用Yii 2..。在我的主-local.php文件中:
'modules' => [
'debug' => 'yii\debug\Module',
'gii' => 'yii\gii\Module',
],
'gii' => [
'class' => 'yii\gii\Module',
'allowedIPs' => ['127.0.0.1', '::1', '50.62.10.149', '50.63.59.230']
]导致错误的原因可能是什么:
Unknown Property – yii\base\UnknownPropertyException
Setting unknown property: yii\web\Application::gii发布于 2014-01-29 06:46:59
像这样试一试。(如果要包含类以外的更多参数,则必须使用数组。)
'modules' => [
'debug' => 'yii\debug\Module', // Think of this as a shortcut syntax.
'gii' => [
'class' => 'yii\gii\Module',
'allowedIPs' => ['127.0.0.1', '::1', '50.62.10.149', '50.63.59.230']
]
],您必须将所有模块配置放在模块数组中。这个错误基本上是自我解释的。您正在尝试使用属性yii\web\Application::gii,但是没有这样的东西。你必须用yii\web\Application::modules代替
发布于 2014-08-07 06:59:46
我知道这是一个较老的问题,但我也被困在这里,要使它正常工作,只在主文件中定义gii组件是不够的,它也必须在main-local中定义:
if (!YII_ENV_TEST) {
// configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
'class' => 'yii\gii\Module',
'allowedIPs' => ['127.0.0.1', '::1', '50.62.10.149'],
];
}
return $config;发布于 2015-02-08 04:11:33
对于YI2.0.1,我不得不和KB9做同样的事情。唯一的区别是,这个代码块现在位于confg/web.php文件中:
if (YII_ENV_DEV) {
// configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = [
'class' => 'yii\debug\Module',
'allowedIPs' => ['127.0.0.1', '::1', '1.2.3.4'],
];
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
'class' => 'yii\gii\Module',
'allowedIPs' => ['127.0.0.1', '::1', '1.2.3.4'],
];
}https://stackoverflow.com/questions/21421918
复制相似问题