-1
我有这样的数组我想要marge主机阵列和ip数组,我想将特定IP地址添加到唯一主机名中作为密钥。我想在每个密钥下创建具有多个动态值的动态数组PHP
[chns_host] => Array
(
[0] => ns1.dafhsdfhfhdkfd.com
[1] => ns2.dafhsdfhfhdkfd.com
[2] => ns1.dafhsdfhfhdkfd.com
[3] => ns2.dafhsdfhfhdkfd.com
)
[chns_ip] => Array
(
[0] => 149.56.51.28
[1] => 149.56.51.29
[2] => 149.56.51.30
[3] => 149.56.51.31
)
我想这个数组转换像
[ns1.dafhsdfhfhdkfd.com] => Array
(
[0] => 149.56.51.28
[1] => 149.56.51.30
)
[ns2.dafhsdfhfhdkfd.com] => Array
(
[0] => 149.56.51.29
[1] => 149.56.51.31
)
IP将需要在特定的关键主机去。
试图代码? – aldrin27
你必须遍历这两个数组,并使用[dns_get_record()](http://php.net/manual/en/function.dns-get-record.php)等网络函数进行检查,并创建一个新数组你的结果。 –