1.打开 protected\config下的main.php ,找到以下这段代码:
'modules'=>array(
// uncomment the following to enable the Gii tool
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'123456', //用于登录gii的密码
// If removed, Gii defaults to localhost only. Edit carefully to taste.
'ipFilters'=>array('127.0.0.1','::1'),
),
),
2.http://localhost/test/index.php?r=gii进入gii 输入main.php的设置的密码进入
3.生成model点击Model Generator,在Table Name输入表名点击preview
无问题后点击Generate生成
3.生成controller和view,点击Crud Generator在Model Class 输入刚刚的Model 注意大小写点击preview预览
无问题后点击Generate生成
完成