Php 通过API存储数据时出错

Php 通过API存储数据时出错,php,html,api,Php,Html,Api,我想从API调用数据以存储在变量中。 我的代码: 行动地图统计 错误: 注意:第14行D:\xampp\htdocs\operation\index.php中的数组到字符串转换 数组第14行: 您必须切换到 因为您将$b视为字符串第14行: 您必须切换到 因为你把$b当作一个字符串写打印($b)而不是第14行的回显“$b”,因为结果是数组。写入打印($b)而不是第14行的回显“$b”,因为结果是数组 <?php $url = "https://api.steampowered.com/

我想从API调用数据以存储在变量中。 我的代码:


行动地图统计
错误: 注意:第14行D:\xampp\htdocs\operation\index.php中的数组到字符串转换 数组

第14行:
您必须切换到
因为您将
$b
视为字符串第14行:
您必须切换到
因为你把
$b
当作一个字符串写
打印($b)而不是第14行的
回显“$b”
,因为结果是数组。

写入
打印($b)而不是第14行的
回显“$b”
,因为结果是数组

<?php $url = "https://api.steampowered.com/ICSGOServers_730/GetGameMapsPlaytime/v1/?format=json&key=E5F331493A95AA54FD1230551754AB19&mapgroup=operation&gamemode=casual&interval=month";

$mapinfo = json_decode(file_get_contents($url), true);
$b = $mapinfo['result'];
?>

<!DOCTYPE html>
<html>
<head>
<title>Operation Maps Stats</title>
</head>

<body>
<?php echo "$b"; ?>
</body>
</html>