【发布时间】:2013-11-28 18:04:43
【问题描述】:
使用带有 laravel 4 的蒸汽冷凝器并通过 composer 安装。
我正在尝试获取 dota2 的玩家库存。我试过了:
WebApi::setApiKey('*******');
$inventory = DotA2Inventory::createInventory('username');
但它给了我:
Class 'DotA2Inventory' not found
我正在我的用户控制器上执行此操作。
Here is the inventory class 和 here is the dota2 inventory class。
我只是想提取用户的库存,以便我可以显示它,包括图片、名称、稀有度和其他物品信息。
更新
所以我发现我忘了添加这个:
require_once STEAM_CONDENSER_PATH . 'steam/community/GameInventory.php';
现在我收到另一个错误:Trying to get property of non-object
protected function _getJSONData($interface, $method, $version = 1, $params = null) {
$data = $this->getJSON($interface, $method, $version, $params);
$result = json_decode($data)->result;
其他信息
我正在使用 1.3.7 版的蒸汽冷凝器。 (检查了我的 steam-condenser.php 以确认这一点)
WebApi.php 第 190 行的错误是“尝试获取非对象的属性”
$result = json_decode($data)->result;
具体是想获取用户76561198115395760的dota 2库存。
【问题讨论】:
-
请为您的问题添加更多详细信息。您使用的是什么版本的 Steam Condenser,错误发生在哪一行(总是欢迎使用堆栈跟踪)?此外,查看导致您的问题的确切用户/库存总是很有趣。
-
@Koraktor 先生,我已经用其他信息更新了我的问题。
-
WebApi.php的第 190 行没有访问属性,因此这不是问题的原因:github.com/koraktor/steam-condenser-php/blob/1.3.7/lib/steam/… -
@Koraktor 奇怪的是这就是错误所说的。在我的 webapi.php 的注释第 190 行是
$result = json_decode($data)->result;
标签: php laravel steam steam-condenser