本文整理匯總了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');
}
}