我有一个使命召唤 4 的玩家列表的多维数组。当我尝试回显该数组时,它会返回Array
30 次,因为服务器中有 30 个当前玩家。
$promodplist 的 Var_Dump(玩家列表)
array(27) {
[0]=> array(6) {
["frags"]=> string(1) "0"
["ping"]=> string(2) "26"
["nick"]=> string(10) "DIVINEBRAH"
["gq_name"]=> string(10) "DIVINEBRAH"
["gq_score"]=> string(1) "0"
["gq_ping"]=> string(2) "26"
}
[1]=> array(6) {
["frags"]=> string(1) "0"
["ping"]=> string(2) "35"
["nick"]=> string(7) "><> <><"
["gq_name"]=> string(7) "><> <><"
["gq_score"]=> string(1) "0"
["gq_ping"]=> string(2) "35"
}
[2]=> array(6) {
["frags"]=> string(1) "0"
["ping"]=> string(2) "42"
["nick"]=> string(10) "xXthe0neXx"
["gq_name"]=> string(10) "xXthe0neXx"
["gq_score"]=> string(1) "0"
["gq_ping"]=> string(2) "42"
}
$servers['promod'] = array('cod4', '67.202.102.224');
$servers['promod2'] = array('cod4', '67.202.102.224');
$gq = new GameQ();
$gq->addServers($servers);
$results = $gq->requestData();
function print_results($results) {
foreach ($results as $id => $data)
这就是我试图用来列出当前玩家的内容。
$promodplist = $data['promod']['players'];
foreach($promodplist as $k => $v)
我只是想nick
在每个数组中回显(昵称)。