【发布时间】:2013-12-21 14:20:07
【问题描述】:
我得到了这个代码
$servers = array(
array(
'type' => 'tf2',
'host' => '193.192.59.191:27015',
),
array(
'type' => 'tf2',
'host' => '193.192.59.191:27025',
),
array(
'type' => 'tf2',
'host' => '193.192.59.191:27035',
),
array(
'type' => 'tf2',
'host' => '193.192.59.191:27045',
),
array(
'type' => 'tf2',
'host' => '193.192.59.191:27055',
),
array(
'type' => 'tf2',
'host' => '193.192.59.191:27065',
),
array(
'type' => 'tf2',
'host' => '193.192.59.191:27075',
),
);
$totalcount = 0;
function print_results($results) {
foreach ($results as $id => $data) {
print_table($data);
}
}
function print_table($data) {
global $totalcount;
$totalcount = $totalcount + $data['gq_maxplayers'];
echo $totalcount;
}
if (!$data['gq_online']) {
}
printf("</tr></tbody>");
}
我希望它只在最后一次执行 print_table 时回显,所以它只会显示一次(在最后一次执行该功能时)。并不是每次它都执行该功能。我该怎么做?谢谢!
【问题讨论】:
-
我认为您没有粘贴整个代码。有漏接电话..