Home >PHP Framework >YII >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:
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:
Click the Preview button to enter the following page:
Complete page:
4. Gii generates CURD
as shown in the picture:
Click the Preview button to display
Click the Generate button to complete the page as follows:
Visit link:
http://backend.com/news
Picture:
##More YIIIntroduction 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!