我正在尝试添加一个特定的变量(gq_numplayers)并显示它。如果数组在数组中,我该怎么做?如果您不明白发生了什么,我正在使用 GameQ (https://github.com/Austinb/GameQ/)。
编辑:var_dump ($results); http://pastebin.com/BSeeWMEb
<?php
// Include the main class file
require '../GameQ.php';
// Define your servers,
// see list.php for all supported games and identifiers.
$servers = array(
array(
'id' => 'server 1',
'type' => 'css',
'host' => '216.52.148.30',
),
array(
'id' => 'server 2',
'type' => 'css',
'host' => '216.52.143.83',
),
array(
'id' => 'server 3',
'type' => 'teamspeak3',
'host' => 'voice.xenogamers.org:8730',
)
);
// Init the class, only need this once
$gq = new GameQ();
$gq->addServers($servers);
//optional settings
$gq->setOption('timeout', 3); // Seconds
$gq->setOption('debug', TRUE);
// You can optionally specify some output filters,
// these will be applied to the results obtained.
$gq->setFilter('normalise');
// Send requests, and parse the data
$results = $gq->requestData();
//make total
$total = array_sum(?!?!?!??!?!?);
echo $results['server 1']['gq_numplayers'];
?>