當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。