1、设置web/index.php文件

defined('YII_ENV_DEV') or define('YII_ENV_DEV', true);

才能访问gii

2、advanced版本修改config/main.php,basic版本是web.php

'modules' => [
        'gii' => [
            'class'      => 'yii\gii\Module',
            'allowedIPs' => ['*', '127.0.0.1', '::1', '192.168.0.*', '192.168.178.20']
        ]
    ],

3、访问yousite/index.php?r=gii