本文整理汇总了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'];
}
}