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


PHP models\ContactForm类代码示例

本文整理汇总了PHP中frontend\models\ContactForm的典型用法代码示例。如果您正苦于以下问题:PHP ContactForm类的具体用法?PHP ContactForm怎么用?PHP ContactForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: actionContact

 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(\Yii::$app->request->post()) && $model->validate()) {
         \Yii::$app->common->sendMail($model->subject, $model->body);
     }
     return $this->render('contact', ['model' => $model]);
 }
开发者ID:vecherskyy,项目名称:dom,代码行数:8,代码来源:MainController.php

示例2: submit

 /**
  * @param array $contactData
  */
 public function submit(array $contactData)
 {
     $contactForm = new ContactForm();
     foreach ($contactData as $field => $value) {
         $inputType = $field === 'body' ? 'textarea' : 'input';
         $this->actor->fillField($inputType . '[name="' . $contactForm->formName() . '[' . $field . ']"]', $value);
     }
     $this->actor->click('contact-button');
 }
开发者ID:wangjstu,项目名称:PHPSTU,代码行数:12,代码来源:ContactPage.php

示例3: actionContact

 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load($_POST) && $model->contact(Yii::$app->params['adminEmail'])) {
         Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.');
         return $this->refresh();
     } else {
         return $this->render('contact', array('model' => $model));
     }
 }
开发者ID:nsanden,项目名称:Yii2-AspectMock,代码行数:10,代码来源:SiteController.php

示例4: actionContact

 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
开发者ID:sapgv,项目名称:distributive,代码行数:10,代码来源:SiteController.php

示例5: actionFeedback

 public function actionFeedback()
 {
     $model = new ContactForm();
     if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->settings->get('main.supportEmail'))) {
             return 'Спасибо за ваше сообщение, мы обязательно ответим вам в ближайшее время.';
         } else {
             return 'Что то пошло не так :( Попробуйте позднее';
         }
     }
     return 'Что то пошло не так :(';
 }
开发者ID:sergey-exu,项目名称:goldex,代码行数:12,代码来源:SiteController.php

示例6: actionContact

 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(\Yii::$app->request->post()) && $model->validate()) {
         $body = " <div>Body: <b> " . $model->body . " </b></div>";
         $body .= " <div>Email: <b> " . $model->email . " </b></div>";
         \Yii::$app->common->sendMail($model->subject, $body);
         print "Send success";
         die;
     }
     return $this->render("contact", ['model' => $model]);
 }
开发者ID:sgsani,项目名称:yii.project,代码行数:12,代码来源:MainController.php

示例7: actionContact

 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(\Yii::$app->request->post()) && $model->validate()) {
         $body = '<div>Body: <b>' . $model->body . ' </b></div>';
         $body .= '<div>Email: <b>' . $model->email . ' </b></div>';
         \Yii::$app->common->sendMail($model->subject, $body);
         print 'Send success';
     }
     return $this->render('contact', ['model']);
     //return $this->render('inner');
 }
开发者ID:pers1307,项目名称:yii,代码行数:12,代码来源:MainController.php

示例8: actionContact

 /**
  * Contact.
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(\Yii::$app->request->post()) && $model->validate()) {
         $success = $model->sendEmail(\Yii::$app->params['adminEmail']);
         if ($success) {
             \Yii::$app->session->setFlash('success', 'Your message has been sent!');
             $this->refresh('#form');
         }
     }
     return $this->render('contact', ['model' => $model]);
 }
开发者ID:Krinnerion,项目名称:shop,代码行数:15,代码来源:DefaultController.php

示例9: actionContact

 /**
  * Displays the contact static page and sends the contact email.
  *
  * @return string|\yii\web\Response
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->contact(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.');
         } else {
             Yii::$app->session->setFlash('error', 'There was an error sending email.');
         }
         return $this->refresh();
     }
     return $this->render('contact', ['model' => $model]);
 }
开发者ID:ricardorsierra,项目名称:personalControl,代码行数:18,代码来源:SiteController.php

示例10: actionContact

 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($model->contact(Yii::$app->params['adminEmail'])) {
             Yii::$app->getSession()->setFlash('alert', ['body' => Yii::t('frontend', 'Thank you for contacting us. We will respond to you as soon as possible.'), 'options' => ['class' => 'alert-success']]);
             return $this->refresh();
         } else {
             Yii::$app->getSession()->setFlash('alert', ['body' => \Yii::t('frontend', 'There was an error sending email.'), 'options' => ['class' => 'alert-danger']]);
         }
     }
     return $this->render('contact', ['model' => $model]);
 }
开发者ID:ArtTum,项目名称:yii2-portfolio-landing,代码行数:13,代码来源:SiteController.php

示例11: actionContact

 /**
  * Displays the contact static page and sends the contact email.
  *
  * @return string|\yii\web\Response
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if (!$model->load(Yii::$app->request->post()) || !$model->validate()) {
         return $this->render('contact', ['model' => $model]);
     }
     if (!$model->sendEmail(Yii::$app->params['adminEmail'])) {
         Yii::$app->session->setFlash('error', Yii::t('app', 'There was some error while sending email.'));
         return $this->refresh();
     }
     Yii::$app->session->setFlash('success', Yii::t('app', 'Thank you for contacting us. We will respond to you as soon as possible.'));
     return $this->refresh();
 }
开发者ID:firdows,项目名称:yii2-advanced-template,代码行数:18,代码来源:SiteController.php

示例12: actionContact

 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', 'Terima kasih sudah menghubungi kami. Pertanyaan anda akan kami jawab secepatnya.. ');
         } else {
             Yii::$app->session->setFlash('error', 'Maaf pesan gagal dikirim.coba ulangi lagi.');
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
开发者ID:cakpep,项目名称:spk-tht,代码行数:14,代码来源:SiteController.php

示例13: actionContact

 /**
  * Displays contact page.
  *
  * @return mixed
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', ['type' => 'success', 'duration' => 12000, 'icon' => 'fa fa-envelope', 'message' => 'Thank you for contacting us. We will respond to you as soon as possible.', 'title' => 'Sending Message']);
         } else {
             Yii::$app->session->setFlash('error', ['type' => 'danger', 'duration' => 12000, 'icon' => 'fa fa-envelope', 'message' => 'There was an error sending email.', 'title' => 'Sending Message']);
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
开发者ID:ninjacto,项目名称:ninjacto.com,代码行数:19,代码来源:SiteController.php

示例14: actionContact

 /**
  * Displays contact page.
  *
  * @return mixed
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', 'Cảm ơn bạn đã liên hệ với chúng tôi. Chúng tôi sẽ liên hệ lại với bạn trong thời gian sớm nhất.');
         } else {
             Yii::$app->session->setFlash('error', 'Có lỗi trong quá trình gửi mail.');
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
开发者ID:nguyentuansieu,项目名称:phutungoto,代码行数:19,代码来源:SiteController.php

示例15: actionContact

 /**
  * Displays contact page.
  *
  * @return mixed
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', Yii::t('c/radiata/contact', 'Thank you'));
         } else {
             Yii::$app->session->setFlash('error', Yii::t('c/radiata/contact', 'Errors'));
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
开发者ID:radiata-cms,项目名称:radiata,代码行数:19,代码来源:SiteController.php


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