嘿伙计们,所以我有一个类似
的数组Array (
[more] => 1
[routingTable] => Array (
[0] => Array (
[ip] =>fcca:948b:3c04:f481:e678:8539:a57e:197a
[link] => 90731030
[path] => 0000.0000.271a.c907
[isDct] => 1
)
[1] => Array (
[ip] => fc1c:fc12:2735:0c17:c864:5273:c66e:558f
[link] => 74624930
[path] => 0000.0000.006e.c907
[isDct] => 1
)
[2] => Array (
[ip] => fcf3:2015:05f7:e2d8:39e8:51ca:1cd5:b29b
[link] => 188709805
[path] => 0000.0000.2ab6.c387
[isDct] => 1
)
[3] => Array ( [ip] => fcf6:28f2:3522:8ad0:57ad:cc26:0a6e:27a3 [link] => 7331630 [path] => 0000.001c.4fca.4387 [isDct] => 1 ) [4] => Array ( [ip] => fc99:02f4:7795:c86c:36bd:63ae:cf49:d459 [link] => 188709805 [path] => 0000.0000.0006.4387 [isDct] => 1 ) [5] => Array ( [ip] => fcf3:ca3a:d5a9:3552:7e71:afa7:e87c:f1ce [link] => 188709805 [path] => 0000.0000.0006.c387 [isDct] => 1 ) [6] => Array ( [ip] => fc93:e5b5:7cde:7983:f50c:fe31:106b:1f88 [link] => 87509810 [path] => 0000.0000.004e.c387 [isDct] => 1 ) [7] => Array ( [ip] => fcd4:1dc1:cc08:c97d:85e2:6cad:eab8:0864 [link] => 188709805 [path] => 0000.0000.0056.c387 [isDct] => 1 ) [8] => Array ( [ip] => fce8:78b3:fa72:84a6:f737:e85f:7525:46a3 [link] => 188709805 [path] => 0000.0000.0076.c387 [isDct] => 1 ) [9] => Array ( [ip] => fc19:e2db:7977:6d2c:15ce:4363:19cc:6bd6 [link] => 127238194 [path] => 0000.0000.01e1.0387 [isDct] => 1 ) [10] => Array ( [ip] => fc1b:7538:824d:ccf2:f5da:96eb:a04a:f6e4 [link] => 188709805 [path] => 0000.0000.036a.4387 [isDct] => 1 ) [11] => Array ( [ip] => fc1f:8b91:f3e8:73b9:c46f:ed52:d09f:1c81 [link] => 188709805 [path] => 0000.0000.029a.4387 [isDct] => 1 ) [12] => Array ( [ip] => fcf6:28f2:3522:8ad0:57ad:cc26:0a6e:27a3 [link] => 188709805 [path] => 0000.0000.0000.4607 [isDct] => 1 ) [13] => Array ( [ip] => fcf6:28f2:3522:8ad0:57ad:cc26:0a6e:27a3 [link] => 279709270 [path] => 0000.0000.0000.43c3 [isDct] => 1 ) [14] => Array ( [ip] => fcc7:3fc5:d3f2:f66e:ec97:25e3:4a3d:948c [link] => 188709805 [path] => 0000.0000.0000.4387 [isDct] => 1 ) [15] => Array ( [ip] => fcca:948b:3c04:f481:e678:8539:a57e:197a [link] => 278098660 [path] => 0000.0138.cfe9.c383 [isDct] => 1 ) [16] => Array ( [ip] => fcf6:28f2:3522:8ad0:57ad:cc26:0a6e:27a3 [link] => 9158 [path] => 0000.0000.02f8.c087 [isDct] => 1 ) [17] => Array ( [ip] => fc3a:956e:4b69:1c1e:5ebc:11a5:3e71:3e7e [link] => 0 [path] => 0000.0000.0348.c087 [isDct] => 1 ) [18] => Array ( [ip] => fc93:e5b5:7cde:7983:f50c:fe31:106b:1f88 [link] => 107374000 [path] => 0000.0000.02ad.8087 [isDct] => 1 ) [19] => Array ( [ip] => fc76:582b:9762:fcb6:1459:9564:f934:e02d [link] => 177703971 [path] => 0000.0095.8ea9.c4c7 [isDct] => 1 ) [20] => Array ( [ip] => fc41:bcf4:4c13:5cc6:d96d:aadc:74c2:df2a [link] => 177703970 [path] => 0000.008b.8ea9.c4c7 [isDct] => 1 ) [21] => Array ( [ip] => fce9:df87:2170:6a3d:e0d4:67a5:c82d:1bc0 [link] => 177703970 [path] => 0000.008d.0ea9.c4c7 [isDct] => 1 ) [22] => Array ( [ip] => fc56:926d:c133:bc89:e6eb:640c:aa4e:0cb2 [link] => 774372 [path] => 0000.0092.0ea9.c4c7 [isDct] => 1 ) [23] => Array ( [ip] => fcd9:c8a0:c35c:ba2e:e3de:b497:8706:2aab [link] => 99320952 [path] => 0000.008e.0ea9.c4c7 [isDct] => 1 ) [24] => Array ( [ip] => fcac:541e:9c5c:9ddc:f648:962a:2892:e33e [link] => 0 [path] => 0000.0086.8ea9.c4c7 [isDct] => 1 ) [25] => Array ( [ip] => fcd4:1dc1:cc08:c97d:85e2:6cad:eab8:0864 [link] => 188709805 [path] => 0000.0083.8ea9.c4c7 [isDct] => 1 ) [26] => Array ( [ip] => fc36:4345:785d:cbe6:fc6d:5d61:507a:d721 [link] => 25769760 [path] => 0000.008f.0ea9.c4c7 [isDct] => 1 ) [27] => Array ( [ip] => fca5:372b:57be:78aa:e490:6b0f:da2a:c882 [link] => 43486470 [path] => 0000.0094.0ea9.c4c7 [isDct] => 1 ) [28] => Array ( [ip] => fc73:81dc:9b2e:3095:cd37:0214:114e:d27f [link] => 0 [path] => 0000.049c.46a4.8047 [isDct] => 1 ) [29] => Array ( [ip] => fc30:5b55:a53d:c456:3c3d:da26:4759:3cbc [link] => 132321905 [path] => 0000.0091.0ea9.c4c7 [isDct] => 1 ) [30] => Array ( [ip] => fccf:3418:31dd:4126:c23a:1d73:4a2c:15e5 [link] => 774372 [path] => 0000.0097.0ea9.c4c7 [isDct] => 1 ) [31] => Array ( [ip] => fc05:2d70:2146:9298:73b9:14fb:d7a9:633a [link] => 257697600 [path] => 0000.0000.0007.4483 [isDct] => 1 ) [32] => Array ( [ip] => fcf3:2015:05f7:e2d8:39e8:51ca:1cd5:b29b [link] => 257697600 [path] => 0000.0000.026b.4483 [isDct] => 1 ) [33] => Array ( [ip] => fcd6:b2a5:e3cc:d78d:fc69:a90f:4bf7:4a02 [link] => 264676910 [path] => 0000.0000.0006.c483 [isDct] => 1 ) [34] => Array ( [ip] => fccc:3ddb:f184:ee46:ae1a:f2a4:4f79:1ee7 [link] => 34930104 [path] => 0000.0000.02fa.c483 [isDct] => 1 ) [35] => Array ( [ip] => fc98:82c4:0fca:f53e:2132:426a:c879:083c [link] => 159987260 [path] => 0000.0000.039a.c483 [isDct] => 1 ) [36] => Array ( [ip] => fcf6:28f2:3522:8ad0:57ad:cc26:0a6e:27a3 [link] => 7046418 [path] => 0000.0000.038a.c483 [isDct] => 1 ) [37] => Array ( [ip] => fce8:78b3:fa72:84a6:f737:e85f:7525:46a3 [link] => 221190440 [path] => 0000.0000.02ca.c483 [isDct] => 1 ) [38] => Array ( [ip] => fcc7:3fc5:d3f2:f66e:ec97:25e3:4a3d:948c [link] => 190857286 [path] => 0000.0000.02ea.c483 [isDct] => 1 ) [39] => Array ( [ip] => fc5d:baa5:61fc:6ffd:9554:67f0:e290:7535 [link] => 190857285 [path] => 0000.0000.021a.c483 [isDct] => 1 ) [40] => Array ( [ip] => fcd9:c8a0:c35c:ba2e:e3de:b497:8706:2aab [link] => 190857285 [path] => 0000.0000.03ca.c483 [isDct] => 1 ) [41] => Array ( [ip] => fcd4:1dc1:cc08:c97d:85e2:6cad:eab8:0864 [link] => 264676910 [path] => 0000.0000.027a.c483 [isDct] => 1 ) [42] => Array ( [ip] => fc38:4c2c:1a8f:3981:f2e7:c2b9:6870:6e84 [link] => 4294960 [path] => 0000.0002.aa0b.c007 [isDct] => 1 ) [43] => Array ( [ip] => fcd9:6fcc:642c:c70d:5ff2:63c3:8ead:c9ad [link] => 0 [path] => 0000.0000.0c7b.c007 [isDct] => 1 ) [44] => Array ( [ip] => fc5b:0934:7fce:3885:7fe7:ab23:8743:3e14 [link] => 124285405 [path] => 0000.001a.df21.8047 [isDct] => 1 ) [45] => Array ( [ip] => fcf6:28f2:3522:8ad0:57ad:cc26:0a6e:27a3 [link] => 147102381 [path] => 0000.0000.30be.c907 [isDct] => 1 ) [46] => Array ( [ip] => fcf3:2015:05f7:e2d8:39e8:51ca:1cd5:b29b [link] => 32212200 [path] => 0000.0154.a496.c387 [isDct] => 1 ) [47] => Array ( [ip] => fc97:d627:b1b6:3021:7b55:1ea3:1b3b:75a5 [link] => 188709805 [path] => 0000.0000.02eb.c007 [isDct] => 1 ) [48] => Array ( [ip] => fccc:3ddb:f184:ee46:ae1a:f2a4:4f79:1ee7 [link] => 26843500 [path] => 0000.0000.0329.8007 [isDct] => 1 ) [49] => Array ( [ip] => fcca:948b:3c04:f481:e678:8539:a57e:197a [link] => 188709805 [path] => 0000.0000.03e9.8007 [isDct] => 1 ) [50] => Array ( [ip] => fce1:b388:04e8:c4ff:654a:3e62:2c68:77ee [link] => 44560210 [path] => 0000.0000.2ea9.8007 [isDct] => 1 ) [51] => Array ( [ip] => fc3a:2804:615a:b34f:abfe:c7d5:65d6:f50c [link] => 135291240 [path] => 0000.0000.36a9.8007 [isDct] => 1 ) [52] => Array ( [ip] => fcd5:c432:affb:7e77:a754:74e0:5e98:12d3 [link] => 148176120 [path] => 0000.0000.32a9.8007 [isDct] => 1 ) [53] => Array ( [ip] => fc37:acb2:544b:ed86:8b8d:9945:add7:b119 [link] => 142807420 [path] => 0000.0000.26a9.8007 [isDct] => 1 ) [54] => Array ( [ip] => fc38:4c2c:1a8f:3981:f2e7:c2b9:6870:6e84 [link] => 188709805 [path] => 0000.0000.2aa9.8007 [isDct] => 1 ) [55] => Array ( [ip] => fc93:e5b5:7cde:7983:f50c:fe31:106b:1f88 [link] => 18186471 [path] => 0000.0000.33e9.8007 [isDct] => 1 ) [56] => Array ( [ip] => fc09:c762:d144:4e53:bb79:372c:28dd:2cd6 [link] => 166966572 [path] => 0000.0000.1549.8007 [isDct] => 1 ) [57] => Array ( [ip] => fcbd:9678:6e2c:568e:ea0d:6cc0:69f1:9996 [link] => 123480101 [path] => 0000.0001.fde9.8007 [isDct] => 1 ) [58] => Array ( [ip] => fcef:c7a9:792a:45b3:741f:59aa:9adf:4081 [link] => 81335805 [path] => 0000.0000.18c7.8043 [isDct] => 1 ) [59] => Array ( [ip] => fcb4:baa6:ca46:5255:8514:53da:28dc:1337 [link] => 44560210 [path] => 0000.0000.2aa9.c787 [isDct] => 1 ) [60] => Array ( [ip] => fcef:c7a9:792a:45b3:741f:59aa:9adf:4081 [link] => 137438720 [path] => 0000.0001.8ca9.c787 [isDct] => 1 ) [61] => Array ( [ip] => fc74:b146:a580:2be9:6285:7af3:6a56:2b7b [link] => 0 [path] => 0000.000a.22c7.8043 [isDct] => 1 ) [62] => Array ( [ip] => fc00:9846:1c48:9a10:9c1b:3bbc:2322:face [link] => 52613260 [path] => 0000.0001.94a9.c787 [isDct] => 1 ) [63] => Array ( [ip] => fc13:6176:aaca:8c7f:9f55:924f:26b3:4b14 [link] => 1 [path] => 0000.0000.32b6.8043 [isDct] => 1 ) [64] => Array ( [ip] => fc2c:700f:63fa:2eb1:c360:059d:9b3e:1703 [link] => 188709805 [path] => 0000.0000.0034.81c7 [isDct] => 1 ) [65] => Array ( [ip] => fc85:f077:1447:a03e:bae3:30b2:1e87:63b3 [link] => 2147480 [path] => 0000.0037.2a0b.c007 [isDct] => 1 ) [66] => Array ( [ip] => fc2c:700f:63fa:2eb1:c360:059d:9b3e:1703 [link] => 188709805 [path] => 0000.0000.348e.c087 [isDct] => 1 ) [67] => Array ( [ip] => fcd4:1dc1:cc08:c97d:85e2:6cad:eab8:0864 [link] => 188709805 [path] => 0000.0000.004e.c087 [isDct] => 1 ) [68] => Array ( [ip] => fc7e:854a:b6fe:440b:965d:e487:58fb:5701 [link] => 185220150 [path] => 0000.0000.298e.c087 [isDct] => 1 ) [69] => Array ( [ip] => fc9a:8c7e:a05f:62c0:4872:a860:0610:2e4b [link] => 61203180 [path] => 0000.0000.318e.c087 [isDct] => 1 ) [70] => Array ( [ip] => fc99:02f4:7795:c86c:36bd:63ae:cf49:d459 [link] => 294649 [path] => 0000.0000.0056.c087 [isDct] => 1 ) [71] => Array ( [ip] => fcf1:b5d5:d0b4:c390:9db2:3f5e:d2d2:bff2 [link] => 294649 [path] => 0000.0000.2196.c087 [isDct] => 1 ) [72] => Array ( [ip] => fc58:7ce1:b011:920f:5ac7:98dd:e3c4:0c81 [link] => 294650 [path] => 0000.0000.3296.c087 [isDct] => 1 ) [73] => Array ( [ip] => fcac:541e:9c5c:9ddc:f648:962a:2892:e33e [link] => 0 [path] => 0000.0000.2b96.c087 [isDct] => 1 ) [74] => Array ( [ip] => fca6:83a5:de61:21da:9f57:b943:c039:ffde [link] => 188709805 [path] => 0000.0000.0005.ca47 [isDct] => 1 ) [75] => Array ( [ip] => fc2c:700f:63fa:2eb1:c360:059d:9b3e:1703 [link] => 0 [path] => 0000.0000.03b8.c087 [isDct] => 1 ) [76] => Array ( [ip] => fc99:02f4:7795:c86c:36bd:63ae:cf49:d459 [link] => 124553840 [path] => 0000.0001.7140.c707 [isDct] => 1 ) [77] => Array ( [ip] => fc3a:956e:4b69:1c1e:5ebc:11a5:3e71:3e7e [link] => 107374000 [path] => 0000.00d2.7140.c707 [isDct] => 1 ) [78] => Array ( [ip] => fc72:6c3b:8c74:68a7:d8c3:b4e0:6cbd:9588 [link] => 100394690 [path] => 0000.008a.7140.c707 [isDct] => 1 ) [79] => Array ( [ip] => fcf1:b5d5:d0b4:c390:9db2:3f5e:d2d2:bff2 [link] => 0 [path] => 0000.0086.7140.c707 [isDct] => 1 ) [80] => Array ( [ip] => fc58:7ce1:b011:920f:5ac7:98dd:e3c4:0c81 [link] => 124553841 [path] => 0000.00ca.7140.c707 [isDct] => 1 ) [81] => Array ( [ip] => fcac:541e:9c5c:9ddc:f648:962a:2892:e33e [link] => 0 [path] => 0000.00ae.7140.c707 [isDct] => 1 ) [82] => Array ( [ip] => fce1:3a9f:4546:e9e5:6646:88f9:1b18:8d18 [link] => 83214850 [path] => 0000.00aa.7140.c707 [isDct] => 1 ) [83] => Array ( [ip] => fcfc:89e0:da25:3e98:23be:bc9a:4114:48d5 [link] => 1 [path] => 0000.00c6.7140.c707 [isDct] => 1 ) [84] => Array ( [ip] => fc9a:62c1:75d2:b027:ca9d:9278:4a22:bc37 [link] => 120795750 [path] => 0000.00a2.7140.c707 [isDct] => 1 ) [85] => Array ( [ip] => fc90:8f10:9ca3:12a1:ab12:c98d:0680:d915 [link] => 122406360 [path] => 0000.00b6.7140.c707 [isDct] => 1 ) [86] => Array ( [ip] => fcc7:3fc5:d3f2:f66e:ec97:25e3:4a3d:948c [link] => 0 [path] => 0000.00ba.7140.c707 [isDct] => 1 ) [87] => Array ( [ip] => fc8f:aa30:3bba:8b3e:12fd:44a5:0322:77ff [link] => 79456760 [path] => 0000.000b.2071.4a03 [isDct] => 1 ) [88] => Array ( [ip] => fcf6:28f2:3522:8ad0:57ad:cc26:0a6e:27a3 [link] => 113816440 [path] => 0000.0001.c4fa.c907 [isDct] => 1 ) [89] => Array ( [ip] => fc74:b146:a580:2be9:62 [isDct] => 1 ) ) [isDct] => 1 )
我需要抓住所有ip(键“ip”的值)并将它们放入像ips这样的普通数组中[]
我尝试了一些东西,但是我已经使用了PHP它已经很久了,它还没有到来, 任何帮助都很棒!
答案 0 :(得分:4)
$ips = array_map(function($i) { return $i['ip']; }, $arr['routingTable']);
如果你没有php> = 5.3 - 只需使用普通的foreach
并手动收集数据
答案 1 :(得分:2)
使用zerkms答案,但对于PHP< 5.3:
$i=-1;
foreach($arr['routingTable'] as $a){
$i++;
$ips[] = $a[$i]['ip'];
}