如何在没有 foreach 循环的情况下从 i json 获取“avatarmedium”? 这是我当前的代码:
$json = '{
"response": {
"players": [
{
"steamid": "76561198019025166",
"avatarmedium": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/d3/d3ca76e0f1e8d071e826bc3baeebd0e7215e50e2_medium.jpg"
}
]
}
}';
$result = json_decode ($json);
echo $json->response[0]->players->profileurl;
<?php
$json = '{
"response": {
"players": [
{
"steamid": "76561198019025166",
"avatarmedium": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/d3/d3ca76e0f1e8d071e826bc3baeebd0e7215e50e2_medium.jpg"
}
]
} }';
$result = json_decode ($json);
echo $result->response->players[0]->avatarmedium;