如何访问像这样的对象数组中的数据?在foreach循环中。
[name:SteamPlayer:private] => Pingu Gaige
完整数组:http://paste.laravel.com/Xic
我有:
foreach($players as $player){
echo $player.. now I'm lost.
}
答案 0 :(得分:0)
如果不是私人的话,这可能会有效:
foreach($players as $key => value){
echo 'name : '. $key . ' and ' $value->connectTime .
}
答案 1 :(得分:0)
你在这里指的是Steam Condenser的SteamPlayer
课程。 (Full code on GitHub)
foreach($players as $key => value){
echo "{$value->getName()} has a score of {$value->getScore()}\n";
}