标签:admin base splay else amp html标签 func yii success
// 发送邮件
public function actionEmail($id)
{
$data = Reserve::find()->where([‘id‘=>$id])->asArray()->one();
$mail= Yii::$app->mailer->compose();
$mail->setTo($data[‘u_email‘]);
$mail->setSubject("旅游线路预定确认");
// $mail->setTextBody($data[‘msg‘]); //发布纯文字文本
$mail->setHtmlBody("尊敬的".$data[‘username‘]."你好!<br>您在".date(‘Y-m-d H:i:s‘,$data[‘addtime‘])."时预定了景区的门票,请点击<br>http://www.yii2admin.com/?r=".urlencode(‘travel/agree‘)."&id=".base64_encode($id)."<br>确认"); //发布可以带html标签的文本
if($mail->send())
{
echo "success";
}
else
{
echo "failse";
}
}
// 确认邮件
public function actionAgree()
{
$arr = Yii::$app->request->get();
$id = base64_decode($arr[‘id‘]);
$res = Reserve::find()->where([‘id‘=>$id])->one();
$res->statue=‘1‘;
if($res->save())
{
header("refresh:3;url=?r=travel/show");
print(‘预定成功正在加载,请稍等...<br>三秒后自动跳转~~~‘);
}
}
标签:admin base splay else amp html标签 func yii success
原文地址:http://www.cnblogs.com/sensai-sun/p/6747242.html