Steam api 文件为空

Steam api file empty

当我尝试从 Steam api 解码 json 时,它说

Filename cannot be empty

抱歉,如果答案很明显,我是 php 的新手。

$api_url1 =  "http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=$api_key&steamid=$steamid&format=json";
$json1 = json_decode(file_get_contents($api_url), true);

我的 $api_key$steamid 变量也是以前定义的。

$api_url1 = "http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=". $api_key ."&steamid=". $steamid ."&format=json";
$json1 = json_decode($api_url1, true);

然后您可以使用 foreach 循环遍历所有结果。