我正在尝试将每个比赛 ID 存储在以下函数中:
function getSoccerByCountry($appKey, $sessionToken, $country, $competitionid)
{
$jsonResponse = sportsApingRequest($appKey, $sessionToken, 'listMarketCatalogue', '{"filter":{
"eventTypeIds": [
"1"
],"competitionIds":["' . $competitionid . '"],"marketTypeCodes":["MATCH_ODDS"],"marketCountries":["' . $country . '"],"inPlayOnly": true
},
"maxResults": "200",
"marketProjection": [
"COMPETITION",
"EVENT",
"EVENT_TYPE",
"RUNNER_DESCRIPTION",
"RUNNER_METADATA",
"MARKET_START_TIME"
]
},
"id": 1}
]');
我为每个循环创建了这个循环,该循环循环数组的每个键值并仅获取传递给 getSoccerByCountry 函数的比赛 id。
foreach ($getSoccerComp as $key1)
{
$getSoccerCountry = getSoccerByCountry($appKey, $sessionToken, $countrycode, $key1->competition->id);
}
虽然,所有比赛 id 都作为一个整数传递,但我希望它们以逗号分隔传递。