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


PHP ContactForm::contact方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: testContact

 /**
  * Test contact.
  */
 public function testContact()
 {
     $model = new ContactForm();
     $model->attributes = ['name' => 'Tester', 'email' => 'tester@example.com', 'subject' => 'very important letter subject', 'body' => 'body of current message'];
     $model->contact('admin@example.com');
     $this->specify('email should be send', function () {
         expect('email file should exist', file_exists($this->getMessageFile()))->true();
     });
     $this->specify('message should contain correct data', function () use($model) {
         $emailMessage = file_get_contents($this->getMessageFile());
         expect('email should contain user name', $emailMessage)->contains($model->name);
         expect('email should contain sender email', $emailMessage)->contains($model->email);
         expect('email should contain subject', $emailMessage)->contains($model->subject);
         expect('email should contain body', $emailMessage)->contains($model->body);
     });
 }
开发者ID:ricardorsierra,项目名称:personalControl,代码行数:19,代码来源:ContactFormTest.php

示例6: actionContact

 /**
  * Displays contact page.
  *
  * @return mixed
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->contact()) {
         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', ['model' => $model]);
     }
 }
开发者ID:niranjan1990,项目名称:izone,代码行数:15,代码来源:SiteController.php


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