Home > php教程 > PHP开发 > Yii2.0 uses Gii to generate code

Yii2.0 uses Gii to generate code

伊谢尔伦
Release: 2016-11-25 14:29:29
Original
1115 people have browsed it

Open Gii

config/web.php:

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

Set YII_ENV_DEV in web/index.php:

defined('YII_ENV') or define('YII_ENV', 'dev');
Copy after login

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
],
Copy after login

Test:

http://hostname/index.php?r=gii
Copy after login

Yii2.0 uses Gii to generate code

Related labels:
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template