0

我正在使用防暴游戏的 API。我需要列出所有的冠军,以及与之相关的比赛和其他一些记录。这是我将$championInfo通过发送第一个请求来获得所有冠军的代码

    foreach($championsInfo as $key => $value){
    global $wpdb;
    $API_Booster_ID = $value['champion_id'];
    $API_Booster_Name = $value['champion_name'];
    $API_Booster_Image = '';
    $API_Summoner_ID = $value['summonerid'];
    Insert Query Here       


    /*Spells Loop*/     
    foreach($value['spells'] as $spellsKey => $spellsValue){

            $API_Spells_Name = $spellsValue['name'];
            $API_Spells_Key = $spellsValue['key'];
            $API_Spells_Image = $spellsValue['image']['full'];

            Inserte Query Here

        }


    foreach($value['matchlist']['matches'] as $matchesKey => $matchesValue){
            Need to send API Request based on match id (this will be more then 600 times for every $championInfo Loop)
            Insert Query Here

        }   

}

如何减少API的请求?我应该如何在 API 的单个请求中或在有限的请求中获取所有记录?

4

0 回答 0