本文整理匯總了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]);
}
示例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'];
}
}