无法在本地主机上的 Yii 框架中打开 Gii

Unable to open Gii in Yii Framework on localhost

我正在尝试在本地主机上的基于 yii 的项目中打开 gii 模块。但它没有开放。我正在使用虚拟主机访问项目 (http://pys.dev not http://localhost/pys.dev)。

if (YII_ENV_DEV) {
// configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = [
    'class' => 'yii\debug\Module',
    'allowedIPs' => ['127.0.0.2'],
];

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

您打算如何访问它?如果您启用了漂亮的网址,那么它应该是 http://domain/gii if not then http://domain/index.php?r=gii

同时在您的 web/index.php 中检查 YII_ENV 是否设置为 dev