当前位置: 首页>>代码示例>>PHP>>正文


PHP MailForm::load方法代码示例

本文整理汇总了PHP中MailForm::load方法的典型用法代码示例。如果您正苦于以下问题:PHP MailForm::load方法的具体用法?PHP MailForm::load怎么用?PHP MailForm::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MailForm的用法示例。


在下文中一共展示了MailForm::load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionMail

 public function actionMail($id)
 {
     $model = new MailForm();
     if (isset(\Yii::$app->request->post()['MailForm'])) {
         $model->load(\Yii::$app->request->post()['MailForm']);
         if ($model->validate()) {
             $class = new $this->module->userClass();
             $criteria = new CDbCriteria();
             $criteria->condition = $this->module->userIdColumn . ' = :id';
             $criteria->params = array(':id' => \Yii::$app->user->identity->id);
             $user = $class::find()->find($criteria);
             $from = $user->getAttribute($this->module->userMailColumn);
             $criteria->params = array(':id' => $model->member_id);
             $user = $class::find()->find($criteria);
             $to = $user->getAttribute($this->module->userMailColumn);
             $name = BbiiMember::find(\Yii::$app->user->identity->id)->member_name;
             $name = ' = ?UTF-8?B?' . base64_encode($name) . '? = ';
             $subject = ' = ?UTF-8?B?' . base64_encode($model->subject) . '? = ';
             $sendto = $model->member_name . " <{$to}>";
             $headers = "From: {$name} <{$from}>\r\n" . "To: {$sendto}\r\n" . "Date: " . date(DATE_RFC2822) . "\r\n" . "Reply-To: {$from}\r\n" . "Message-ID: <" . uniqid('', true) . "@bbii.forum>\r\n" . "MIME-Version: 1.0\r\n" . "Content-type: text/html; charset = UTF-8";
             mail($sendto, $subject, $model->body, $headers);
             \Yii::$app->session->addFlash('notice', Yii::t('BbiiModule.bbii', 'You have sent an e-mail to {member_name}.', array('{member_name}' => $model->member_name)));
             return \Yii::$app->response->redirect(array('forum/view', 'id' => $model->member_id));
         }
     } else {
         $model->member_id = $id;
         $model->member_name = BbiiMember::find($id)->member_name;
     }
     return $this->render('mail', array('model' => $model));
 }
开发者ID:sourcetoad,项目名称:bbii2,代码行数:30,代码来源:MemberController.php


注:本文中的MailForm::load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。