Beispiel #1
0
 /**
  * Создать
  */
 public function actionCreate()
 {
     $model = new User();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return Yii::$app->getResponse()->redirect(['/admin/user/update', 'id' => $model->id]);
     }
     return $this->render('create', ['model' => $model]);
 }
 /**
  * Signs user up.
  *
  * @return 学生注册
  */
 public function actionSignup()
 {
     $model = new User();
     if ($model->load(Yii::$app->request->post())) {
         if ($user = $model->registerUser($this->request->post('User'), $this->request->userIP)) {
             if ($user['code'] == 1) {
                 $this->actionTotrans('成功', '登陆页', 'site/login', $user);
             } else {
                 $this->actionTotrans('错误', '返回', 'site/signup', $user);
             }
         }
     }
     return $this->render('signup', ['model' => $model]);
 }