首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >获取Steam清单

获取Steam清单
EN

Stack Overflow用户
提问于 2015-11-09 21:04:05
回答 1查看 709关注 0票数 0

我想看看库存的用户在网站上。我使用get函数来获取清单CS:GO:

代码语言:javascript
复制
function getInventory($steamapi, $steamid, $userid) {
 }

$url = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=$steamapi&steamids=$steamid";
$json_object = file_get_contents($url);
$json_decoded = json_decode($json_object);

$str = $json_decoded->response->players[0]->steamid;

$urlInv = "http://steamcommunity.com/profiles/" . $str . "/inventory/json/730/2/?trading=1";

$json_object_inv = file_get_contents($urlInv);
$json_decoded_inv = json_decode($json_object_inv, true);

$rgInventory = $json_decoded_inv[rgInventory];
$rgInventory = array_values($rgInventory);

$rgDesc = $json_decoded_inv[rgDescriptions];
$rgDesc = array_values($rgDesc);

$itemnames = array();

*******
}}

当我使用这个的时候,我遇到了这样的麻烦:

警告: array_values()要求参数1为数组,在***\functions.php的第278行//此20字符串中给出了null

警告: array_values()要求参数1为数组,在***\functions.php第281行//此23字符串中给出的值为null

那是什么?

EN

回答 1

Stack Overflow用户

发布于 2015-11-09 21:38:33

如果解码失败,则json_decode返回null:https://secure.php.net/manual/en/function.json-decode.php

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33609753

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档