开启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访问需要在配置文件中作如下设置:
'gii' => [ 'class' => 'yii\gii\Module', 'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.*', '192.168.178.20'] // adjust this to your needs ],
测试:
http://hostname/index.php?r=gii
- 本文固定链接: https://zxbcw.cn/post/2847/
- 转载请注明:必须在正文中标注并保留原文链接
- QQ群: PHP高手阵营官方总群(344148542)
- QQ群: Yii2.0开发(304864863)