當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SignupForm::sendEmail方法代碼示例

本文整理匯總了PHP中frontend\models\SignupForm::sendEmail方法的典型用法代碼示例。如果您正苦於以下問題:PHP SignupForm::sendEmail方法的具體用法?PHP SignupForm::sendEmail怎麽用?PHP SignupForm::sendEmail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在frontend\models\SignupForm的用法示例。


在下文中一共展示了SignupForm::sendEmail方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionSignup

 /**
  * Signs user up.
  *
  * @return mixed
  */
 public function actionSignup()
 {
     $model = new SignupForm();
     $this->layout = 'signup';
     if ($model->load(Yii::$app->request->post())) {
         //echo'<pre>';var_dump($model->birth_year);echo'</pre>';die;
         if ($model->birth_year == '' || $model->birth_month == '' || $model->birth_day == '') {
             Yii::$app->session->setFlash('error', Yii::t('app', 'SignupForm_fill_all_fields'));
         } elseif ($user = $model->signup()) {
             if ($model->sendEmail($model->email)) {
                 //Yii::$app->session->setFlash('success', Yii::t('app', 'SignupForm_reg_success'));
             } else {
                 Yii::$app->session->setFlash('error', Yii::t('app', 'Error_sending_email'));
             }
             return $this->redirect(['index', 'reg-success' => 1]);
             //                if (Yii::$app->getUser()->login($user)) {
             //                    return $this->goHome();
             //                }
         } else {
             Yii::$app->session->setFlash('error', Yii::t('app', 'SignupForm_error_form'));
         }
     }
     return $this->render('signup', ['model' => $model]);
 }
開發者ID:aldegtyarev,項目名稱:fantasy,代碼行數:29,代碼來源:SiteController.php

示例2: actionSignup

 public function actionSignup()
 {
     $model = new SignupForm();
     Yii::$app->response->format = 'json';
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['contactEmail'])) {
             return ['message' => Yii::t('app', 'Thank you for your interest. We will respond to you as soon as possible.'), 'status' => 'success'];
         } else {
             return ['message' => Yii::t('app', 'There was an error during request.'), 'status' => 'error'];
         }
     } else {
         return ['message' => Yii::t('app', 'There was an error during processing your inputs.'), 'status' => 'error'];
     }
 }
開發者ID:zazoley,項目名稱:WebsiteDK,代碼行數:14,代碼來源:SiteController.php


注:本文中的frontend\models\SignupForm::sendEmail方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。