本文整理匯總了PHP中Zend\Validator\EmailAddress::getMXRecord方法的典型用法代碼示例。如果您正苦於以下問題:PHP EmailAddress::getMXRecord方法的具體用法?PHP EmailAddress::getMXRecord怎麽用?PHP EmailAddress::getMXRecord使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\Validator\EmailAddress
的用法示例。
在下文中一共展示了EmailAddress::getMXRecord方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testGetMXRecord
/**
* Test getMXRecord
*/
public function testGetMXRecord()
{
if (!defined('TESTS_ZEND_VALIDATE_ONLINE_ENABLED') || !constant('TESTS_ZEND_VALIDATE_ONLINE_ENABLED')) {
$this->markTestSkipped('Testing MX records has been disabled');
return;
}
$validator = new Validator\EmailAddress(array('useMxCheck' => true, 'allow' => Hostname::ALLOW_ALL));
if (!$validator->isMxSupported()) {
$this->markTestSkipped('Testing MX records is not supported with this configuration');
return;
}
$this->assertTrue($validator->isValid('john.doe@gmail.com'));
$result = $validator->getMXRecord();
$this->assertTrue(!empty($result));
}
示例2: testGetMXRecord
/**
* Test getMXRecord
*/
public function testGetMXRecord()
{
$validator = new Validator\EmailAddress(array('mx' => true, 'allow' => Hostname::ALLOW_ALL));
$this->assertTrue($validator->isValid('john.doe@gmail.com'));
$result = $validator->getMXRecord();
$this->assertTrue(!empty($result));
}