開啟Gii
config/web.php:
$config = [ ... ]; if (YII_ENV_DEV) { $config['bootstrap'][] = 'gii'; $config['modules']['gii'] = 'yii\gii\Module'; }
在web/index.php中設定YII_ENV_DEV:
defined('YII_ENV') or define('YII_ENV', 'dev');
如果是從非localhost存取需要在設定檔中作如下設定:rded
'gii' => [ 'class' => 'yii\gii\Module', 'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.*', '192.168.178.20'] // adjust this to your needs ],