将多维PHP数组转换为HTML表
我试图在HTML表中显示特定域的所有DNS记录 以下是显示记录的当前代码:将多维PHP数组转换为HTML表,php,html,css,arrays,dns,Php,Html,Css,Arrays,Dns,我试图在HTML表中显示特定域的所有DNS记录 以下是显示记录的当前代码: <?php $dns = dns_get_record("stackoverflow.com"); print_r($dns); ?> 我希望下面的代码可以帮助你 主办 类型 等级 TTL 额外的 如果您显示来自$dns@MosheGross没问题,只是为您添加了这个。您的代码中的第二个foreach似乎有问题。它就是这样显示的: Array ( [0] => Array (
<?php
$dns = dns_get_record("stackoverflow.com");
print_r($dns);
?>
我希望下面的代码可以帮助你
主办
类型
等级
TTL
额外的
如果您显示来自$dns@MosheGross没问题,只是为您添加了这个。您的代码中的第二个foreach
似乎有问题。它就是这样显示的:
Array
(
[0] => Array
(
[host] => stackoverflow.com
[class] => IN
[ttl] => 300
[type] => A
[ip] => 151.101.1.69
)
[1] => Array
(
[host] => stackoverflow.com
[class] => IN
[ttl] => 300
[type] => A
[ip] => 151.101.65.69
)
[2] => Array
(
[host] => stackoverflow.com
[class] => IN
[ttl] => 300
[type] => A
[ip] => 151.101.129.69
)
[3] => Array
(
[host] => stackoverflow.com
[class] => IN
[ttl] => 300
[type] => A
[ip] => 151.101.193.69
)
[4] => Array
(
[host] => stackoverflow.com
[class] => IN
[ttl] => 172800
[type] => NS
[target] => ns-358.awsdns-44.com
)
[5] => Array
(
[host] => stackoverflow.com
[class] => IN
[ttl] => 172800
[type] => NS
[target] => ns-1033.awsdns-01.org
)
[6] => Array
(
[host] => stackoverflow.com
[class] => IN
[ttl] => 172800
[type] => NS
[target] => ns-cloud-e1.googledomains.com
)
[7] => Array
(
[host] => stackoverflow.com
[class] => IN
[ttl] => 172800
[type] => NS
[target] => ns-cloud-e2.googledomains.com
)
[8] => Array
(
[host] => stackoverflow.com
[class] => IN
[ttl] => 21600
[type] => SOA
[mname] => ns-cloud-e1.googledomains.com
[rname] => cloud-dns-hostmaster.google.com
[serial] => 1
[refresh] => 21600
[retry] => 3600
[expire] => 259200
[minimum-ttl] => 300
)
[9] => Array
(
[host] => stackoverflow.com
[class] => IN
[ttl] => 300
[type] => MX
[pri] => 1
[target] => aspmx.l.google.com
)
[10] => Array
(
[host] => stackoverflow.com
[class] => IN
[ttl] => 300
[type] => MX
[pri] => 5
[target] => alt1.aspmx.l.google.com
)
[11] => Array
(
[host] => stackoverflow.com
[class] => IN
[ttl] => 300
[type] => MX
[pri] => 5
[target] => alt2.aspmx.l.google.com
)
[12] => Array
(
[host] => stackoverflow.com
[class] => IN
[ttl] => 300
[type] => MX
[pri] => 10
[target] => alt3.aspmx.l.google.com
)
[13] => Array
(
[host] => stackoverflow.com
[class] => IN
[ttl] => 300
[type] => MX
[pri] => 10
[target] => alt4.aspmx.l.google.com
)
[14] => Array
(
[host] => stackoverflow.com
[class] => IN
[ttl] => 300
[type] => TXT
[txt] => MS=ms52592611
[entries] => Array
(
[0] => MS=ms52592611
)
)
[15] => Array
(
[host] => stackoverflow.com
[class] => IN
[ttl] => 300
[type] => TXT
[txt] => google-site-verification=ctogLnZNAdc_CXq8yOhODMLpmugGynjxKecKHDz4oL8
[entries] => Array
(
[0] => google-site-verification=ctogLnZNAdc_CXq8yOhODMLpmugGynjxKecKHDz4oL8
)
)
[16] => Array
(
[host] => stackoverflow.com
[class] => IN
[ttl] => 300
[type] => TXT
[txt] => google-site-verification=o3EMam8yBGo1yEjyybIiZcOunGHOQKpo8JmOtp9n1BU
[entries] => Array
(
[0] => google-site-verification=o3EMam8yBGo1yEjyybIiZcOunGHOQKpo8JmOtp9n1BU
)
)
[17] => Array
(
[host] => stackoverflow.com
[class] => IN
[ttl] => 300
[type] => TXT
[txt] => google-site-verification=rdWtMbplKjbRHGr2dNONfwkqithlUvjr3u6i8QEz_mo
[entries] => Array
(
[0] => google-site-verification=rdWtMbplKjbRHGr2dNONfwkqithlUvjr3u6i8QEz_mo
)
)
[18] => Array
(
[host] => stackoverflow.com
[class] => IN
[ttl] => 300
[type] => TXT
[txt] => v=spf1 ip4:198.252.206.0/24 ip4:192.111.0.0/24 ip4:52.38.191.241 ip4:35.190.247.0/24 ip4:64.233.160.0/19 ip4:66.102.0.0/20 ip4:66.249.80.0/20 ip4:72.14.192.0/18 ip4:74.125.0.0/16 ip4:108.177.8.0/21 ip4:173.194.0.0/16 include:_spf1.stackoverflow.com ~all
[entries] => Array
(
[0] => v=spf1 ip4:198.252.206.0/24 ip4:192.111.0.0/24 ip4:52.38.191.241 ip4:35.190.247.0/24 ip4:64.233.160.0/19 ip4:66.102.0.0/20 ip4:66.249.80.0/20 ip4:72.14.192.0/18 ip4:74.125.0.0/16 ip4:108.177.8.0/21 ip4:173.194.0.0/16 include:_spf1.stackoverflow.com ~all
)
)
)