Home  >  Article  >  PHP Framework  >  How to use gii in yii

How to use gii in yii

angryTom
angryTomOriginal
2020-02-18 11:38:093532browse

How to use gii in yii

How to use gii in yii

1. Configuration

Gii module only It can be used in development mode and is enabled by default, but restricted access to the gii module must be a local request. The allowedIPs in the following configuration can be customized to request the IP or IP range of the Gii module.

'gii' => [
    'class' => 'yii\gii\Module',
    //自定义允许访问gii模块的ip或者ip段
    'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.*', '192.168.178.20'] 
],

2. Access the Gii module

does not enable url rewriting, access address: (recommended related articles and tutorials: yii tutorial )

http://xxx.com/index.php/gii

Turn on url rewriting, the access address should be as follows (depending on the url access rules):

http://xxx.com/gii

is as follows:

How to use gii in yii

3. Gii generates model

Click the start button in the Model Generator section to enter the Generate Model page.

Fill in the information, as shown in the picture:

How to use gii in yii

Click the Preview button to enter the following page:

How to use gii in yii

Complete page:

How to use gii in yii

4. Gii generates CURD

as shown in the picture:

How to use gii in yii

Click the Preview button to display

How to use gii in yii

Click the Generate button to complete the page as follows:

How to use gii in yiiVisit link:

http://backend.com/news

Picture:

How to use gii in yii

##More YII

Introduction to ProgrammingDevelopment technology, please pay attention to PHP Chinese website! !         

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

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