本文整理汇总了PHP中Valid::email_domain方法的典型用法代码示例。如果您正苦于以下问题:PHP Valid::email_domain方法的具体用法?PHP Valid::email_domain怎么用?PHP Valid::email_domain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Valid
的用法示例。
在下文中一共展示了Valid::email_domain方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: email
/**
* Check an email address for correct format.
*
* @param string email address
* @param boolean strict RFC compatibility and valid domain with MX
* @return boolean
*/
public static function email($email, $strict = FALSE)
{
//strict validation
if ($strict === TRUE) {
//check the RFC compatibility and MX
return parent::email($email, TRUE) ? Valid::email_domain($email) : FALSE;
} else {
return parent::email($email);
}
}
示例2: email
/**
* Check an email address for correct format.
*
* @param string email address
* @param boolean valid domain with MX and not disposable email
* @return boolean
*/
public static function email($email, $strict = FALSE)
{
//get the email to check up, clean it
$email = filter_var($email, FILTER_SANITIZE_STRING);
// 1 - check valid email format using RFC 822
if (filter_var($email, FILTER_VALIDATE_EMAIL) === FALSE) {
return FALSE;
}
//strict validation, MX domain and valid domain not disposable
if ($strict === TRUE) {
return Valid::email_domain($email);
}
// wow actually a real email! congrats ;)
return TRUE;
}
示例3: test_email_domain
/**
* Tests Valid::email_domain()
*
* Validate the domain of an email address by checking if the domain has a
* valid MX record.
*
* Test skips on windows
*
* @test
* @dataProvider provider_email_domain
* @param string $email Email domain to check
* @param boolean $correct Is it correct?
*/
public function test_email_domain($email, $correct)
{
if (!$this->hasInternet()) {
$this->markTestSkipped('An internet connection is required for this test');
}
if (!Kohana::$is_windows or version_compare(PHP_VERSION, '5.3.0', '>=')) {
$this->assertSame($correct, Valid::email_domain($email));
} else {
$this->markTestSkipped('checkdnsrr() was not added on windows until PHP 5.3');
}
}