Inheritance: extends yii\base\Model
示例#1
0
 public function actionSendEmail()
 {
     $emailBindRequestForm = new EmailBindRequestForm();
     Yii::$app->response->format = Response::FORMAT_JSON;
     $emailBindRequestForm->email = Yii::$app->session['emailBind'];
     if ($emailBindRequestForm->validate() && $emailBindRequestForm->sendEmail()) {
         return ['status' => 'ok'];
     }
     return ['status' => 'err', 'msg' => $emailBindRequestForm->getFirstError('email')];
 }
示例#2
0
 /**
  * 发送email
  *
  * @return array
  */
 public function actionSendEmail()
 {
     $model = new EmailBindRequestForm();
     $model->email = Yii::$app->session['emailBind'];
     if ($model->sendEmail()) {
         return ['status' => 'success', 'data' => []];
     } else {
         return ['status' => 'fail', 'data' => ['errors' => $model->getErrors('email') ?: ['验证码发送失败,请稍后再试!']]];
     }
 }