0

状态的php手册getmxrr($url, &$mxHosts)

如果找到任何记录,则返回 TRUE;如果未找到记录或发生错误,则返回 FALSE。

但是对于某些域(例如www.yahoo.com、example.com.com)它只返回true但返回参数$mxHosts为空。两个域都没有 MX 记录。checkdnsrr()也返回true

我比较了这些域的 DNS 条目,发现它们都有一个 CNAME 条目,而我测试的其他域以及功能正常工作的域没有它。

为什么会getmxrr()给出checkdnsrr()错误的结果值?这与 CNAME 有什么关系?

4

1 回答 1

1
<?php
getmxrr ('yahoo.com', $out);
print_r($out);

$a = checkdnsrr('yahoo.com', 'MX');
var_dump($a);

Array
(
    [0] => mta7.am0.yahoodns.net
    [1] => mta5.am0.yahoodns.net
    [2] => mta6.am0.yahoodns.net
)
bool(true)

You are right, you must enter domain root without any www.

<?php
getmxrr ('www.yahoo.com', $out);
print_r($out);

Array
(
)
bool(true)
于 2013-02-18T13:04:23.943 回答