【发布时间】:2016-10-10 13:12:28
【问题描述】:
我想对冠军数组进行排序。我想按“ Champions -> 0 -> stats -> totalSessionsPlayed "但我不能。我怎么能短数组?
$url = 'https://tr.api.pvp.net/api/lol/tr/v1.3/stats/by-summoner/3800684/ranked?season=SEASON2016&api_key=RGAPI-2F65B634-F9C5-4DA7-A5E3-1D955D5D1E3B';
$content = file_get_contents($url);
$arr = json_decode($content);
$sorted = sort(array_column($arr, 'totalSessionsPlayed'));
我找到了这段代码,但它不起作用。
【问题讨论】:
-
请在您的问题正文中包含相关的 JSON。
-
不过,请不要全部。
-
请仅相关 JSON。
-
@kyhn1239。您需要从
totalSessionsPlayed单独获取数组中的数据。我是否很好地理解了这个问题。或者以其他方式输出