我的代码有问题我想读这样的数组,
Array
(
[0] => Array
(
[Id] => 0
[Name] => 'Da Siick f0rest ;'
[Frags] => 2
[Time] => 2616
[TimeF] => 43:36
)
[1] => Array
(
[Id] => 0
[Name] => ReTrY
[Frags] => 0
[Time] => 7004
[TimeF] => 01:56:44
)
[2] => Array
(
[Id] => 0
[Name] => huFFle.
[Frags] => 0
[Time] => 434
[TimeF] => 07:14
)
)
我尝试使用这样的代码来读取数组,但是不起作用。我试图回显字符串$ player_nickname,但它没有显示结果。
<?php $players = file_get_contents('http://gametracker.al/../../Example.php?ip='.$server_ip.'&port='.$server_port.'');
foreach ($players as $Player) {
$player_nickname = mysql_real_escape_string($Player['Name']);
$player_score = mysql_real_escape_string($Player['Frags']);
$player_time = mysql_real_escape_string($Player['TimeF']);
$player_nickname = (!empty($player_nickname)) ? $player_nickname : 'anonymous';
echo $player_nickname;
} ?>
谢谢大家。