【发布时间】:2011-04-18 21:56:00
【问题描述】:
当使用 checkdnsrr() 函数时,它有时会说不存在任何记录,但实际上确实存在。
例如
$domain = 'ns1.huubknops.com.';
var_dump(checkdnsrr($domain, 'ANY'));
返回 bool(false),表示没有找到 DNS 记录。但是,如果我这样做:
print_r(dns_get_record($domain));
在同一个域上,它将返回 A 和 AAAA 记录:
Array
(
[0] => Array
(
[host] => ns1.huubknops.com
[type] => AAAA
[ipv6] => 2001:888:1cf8::1
[class] => IN
[ttl] => 42450
)
[1] => Array
(
[host] => ns1.huubknops.com
[type] => A
[ip] => 83.160.95.99
[class] => IN
[ttl] => 42450
)
)
并非所有域都会发生这种情况,只有部分域会发生这种情况。有什么原因或解决方法吗?
【问题讨论】:
-
看起来,除非您指定第二个参数,否则它默认搜索 MX 记录。试试
checkdnsrr('ns1.huubknops.com.', 'A')或checkdnsrr('ns1.huubknops.com.', 'ANY') -
是的,就是这样。现在感觉很愚蠢!