我有一些代码假设要打印域的名称服务器。然而,在打印它们时,它给了我这个:
array(5) {
[0]=>
array(5) {
["host"]=>
string(7) "php.net"
["type"]=>
string(2) "NS"
["target"]=>
string(19) "remote1.easydns.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(32)
}
[1]=>
array(5) {
["host"]=>
string(7) "php.net"
["type"]=>
string(2) "NS"
["target"]=>
string(19) "remote3.easydns.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(32)
}
[2]=>
array(5) {
["host"]=>
string(7) "php.net"
["type"]=>
string(2) "NS"
["target"]=>
string(15) "ns2.easydns.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(32)
}
[3]=>
array(5) {
["host"]=>
string(7) "php.net"
["type"]=>
string(2) "NS"
["target"]=>
string(15) "ns1.easydns.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(32)
}
[4]=>
array(5) {
["host"]=>
string(7) "php.net"
["type"]=>
string(2) "NS"
["target"]=>
string(19) "remote2.easydns.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(32)
}
}
我知道这是一个数组但是我只希望它打印每个名称服务器
remote2.easydns.com
ns1.easydns.com
ns2.easydns.com
remote1.easydns.com
等等
这是我当前的代码:
<?php
$result = dns_get_record("php.net", DNS_NS);
echo '<pre>';
var_dump($result);
echo '</pre>';
?>
Print_r 做了一个非常相似的事情。