我正在尝试将此脚本从查找一组变量(例如(playtime_forever))转换为查找另一个变量(例如(backpack_value)
if (!empty($data->response->games)) {
foreach ($data->response->games as $game) {
if ($game->appid == $game_id) {
$playtime = $game->playtime_forever;
if (($playtime < 5940) && ($playtime > 1)) {
$fh = fopen("final.".$timestamp.".txt", 'a') or die("Can't open file");
...
它最初解析的页面看起来像这样 http://pastebin.com/rnnCsijd
但现在将是这个。从这里拉 http://backpack.tf/api/IGetUsers/v2/?&steamids=76561197992146126&format=json%27;
{
"response": {
"success": 1,
"current_time": 1369669066,
"players": {
"0": {
"steamid": "76561197992146126",
"success": 1,
"backpack_value": 36412.71,
"backpack_update": 1369630863,
"name": ":HIT: Bobo the Monkey Boy",
"notifications": 0
}
}
}
}
一个小改动,但我无法让脚本做我想做的事。如果您能解释如何进行此操作及其背后的步骤,那就太好了。我已经尝试了一段时间,但我无法完成脚本