public function onRun(int $currentTick){
foreach (glob($this->plugin->getDataFolder()."/players/*.json") as $plData) {
$str = file_get_contents($plData);
$json = json_decode($str, true);
$levels = $json["level"];
}
}
我想獲得前5名高值從所有的JSON文件中的「玩家」文件夾中,我只知道如何從所有文件值,但不要不知道如何選擇5更高。有人可以幫忙嗎?如何獲得文件夾內的JSON文件前5位值越高
編輯:JSON文件看起來是這樣的:
{
"coins": 0,
"rank": "Guest",
"accept_friends": true,
"reward_time": 1440,
"level": "29",
"bio": "Today is very cool!c",
"progress": 24.939999999999998,
"local_ip": "10.0.0.1",
"registred": true,
"logged": true
}
顯示'$ json'數組的示例。 – AbraCadaver
好吧,我編輯後,你可以在這裏看到它 – GuyWhoDoThings
你放棄了? – AbraCadaver