本文整理汇总了PHP中ContactForm::setSource方法的典型用法代码示例。如果您正苦于以下问题:PHP ContactForm::setSource方法的具体用法?PHP ContactForm::setSource怎么用?PHP ContactForm::setSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContactForm
的用法示例。
在下文中一共展示了ContactForm::setSource方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mail
$headers .= 'From: marcz@lab1521.com' . "\r\n";
return mail($this->email, $this->subject, $this->message, $headers);
}
}
$emailTemplate = '<table>
<tr><th>First Name</th><td>{{nameFirst}}</td></tr>
<tr><th>Last Name</th><td>{{nameLast}}</td></tr>
<tr><th>Email</th><td>{{email}}</td></tr>
<tr><th>Phone</th><td>{{phone}}</td></tr>
<tr><th>Message</th><td></td></tr>
<tr><td colspan="2">{{message}}</td></tr>
</table>
';
$antiSpam = new AntiSpam();
$mailer = new Mailer();
$mailer->to('info@patriarch.co.nz');
$mailer->subject('Online Enquiry To VineyardForSale');
$mailer->setTemplate($emailTemplate);
if (isset($_POST['antiSpamAnswer']) && isset($_POST['antiSpamToken'])) {
$form = new ContactForm();
$form->setFields(array('nameFirst' => 'required|sanitize', 'nameLast' => 'required|sanitize', 'email' => 'required|email', 'phone' => 'required|sanitize', 'message' => 'required|sanitize', 'antiSpamAnswer' => 'required|sanitize', 'antiSpamToken' => 'required|sanitize'));
$form->setSource($_POST);
$form->setFilter(array($antiSpam, 'answer'), array('antiSpamAnswer', 'antiSpamToken'));
$validation = $form->validate();
if ($validation['success']) {
$mailer->fillTemplate($form->getFields());
$mailer->send();
}
JSON::output($validation);
}
JSON::output($antiSpam->question());