Home  >  Article  >  php教程  >  Yii2.0 uses Gii to generate code

Yii2.0 uses Gii to generate code

伊谢尔伦
伊谢尔伦Original
2016-11-25 14:29:291055browse

Open Gii

config/web.php:

$config = [ ... ];
if (YII_ENV_DEV) {
    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = 'yii\gii\Module';
}

Set YII_ENV_DEV in web/index.php:

defined('YII_ENV') or define('YII_ENV', 'dev');

If accessing from non-localhost, you need to make the following settings in the configuration file:

'gii' => [
    'class' => 'yii\gii\Module',
    'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.*', '192.168.178.20'] // adjust this to your needs
],

Test:

http://hostname/index.php?r=gii

Yii2.0 uses Gii to generate code

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Yii2.0 structure overviewNext article:Yii2.0 structure overview