Home > PHP Framework > YII > body text

How to open Gii in yii framework

(*-*)浩
Release: 2019-11-27 16:13:54
Original
2898 people have browsed it

How to open Gii in yii framework

Get started Gii

Gii is a module in Yii. It can be enabled by configuring the application's modules property.

Generally speaking, there will be the following configuration code in the config/web.php file: (Recommended learning: yii framework)

$config = [ ... ];

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

This configuration indicates that if it is currently a development environment, the application will include the gii module, and the module class is yii\gii\Module.

If you check the application's entry script web/index.php, you will see this line of code setting YII_ENV_DEV to true:

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

Given the definition of this line of code , the application is in development mode, and the Gii module will be opened according to the above configuration.

You can access Gii directly via the URL:

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

INFO: If you access Gii from a machine other than this one, the request will be denied for security reasons.

You can configure Gii to add IP addresses that allow access:

'gii' => [
    'class' => 'yii\gii\Module',
    'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.*', '192.168.178.20'] // 按需调整这里
],
Copy after login

How to open Gii in yii framework

The above is the detailed content of How to open Gii in yii framework. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
yii
source:php.cn
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!