【发布时间】:2014-01-06 16:33:16
【问题描述】:
我正在使用 Firebase PHP 库,我想获取数组中的最后一项。
我试过了:
$todoPath = 'arcade/bonsai/gameInPlay/'.$userID.'/'.$gameID.'/'.$gamePlayID.'/scores/';
$response =$fb->get($todoPath);
$json= json_decode($response, true);
$last = end($json);
$scoreID=$last['name'];
我也试过了:
$todoPath = 'arcade/bonsai/gameInPlay/'.$userID.'/'.$gameID.'/'.$gamePlayID.'/scores/';
$response =$fb->get($todoPath);
$json= json_decode($response, true);
$last = current(array_slice($json, -1));
$scoreID=$last['name'];
这些都不行
【问题讨论】:
-
发送
var_dump($json)看看里面到底有什么?