1.在数据库advanced_yii2的user表的id后新加2个字段first_name,last_name
2.对应修改advanced/frontend/models/SignupForm.php,添加
public $first_name;
public $last_name;
return里面添加:
['first_name', 'required',"message"=>'this is add by aha68.com!'],
['last_name', 'required'],
signupz函数里添加:
$user->first_name = $this->first_name;
$user->last_name = $this->last_name;
3.修改form视图 advanced/frontend/views/site/signup.php
field($model, 'first_name') ?>
field($model, 'last_name') ?>
4.访问: http://https://https://amyflash.com/yii/advanced/frontend/web/index.php?r=site%2Fsignup,注册个新用户玩玩