我想看看库存的用户在网站上。我使用get函数来获取清单CS:GO:
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
那是什么?
发布于 2015-11-09 21:38:33
如果解码失败,则json_decode返回null:https://secure.php.net/manual/en/function.json-decode.php
https://stackoverflow.com/questions/33609753
复制相似问题