我在Google日历帐户中有单独的日历,当我调用日历API时,我现在每次要拨打电话时都需要遍历每组日历。我有5个日历组,我只想读取它们,大约需要4秒钟才能分别询问每组日历。
当我调用calendar-api时,是否可以同时传递所有日历?
// Look for the calendars we need to check
$queryCalendars = $dbase->prepare('SELECT `calendar` FROM `googleCalanders`');
$queryCalendars->execute();
while ($row = $queryCalendars->fetch(PDO::FETCH_OBJ)) {
$checkCalandars[] = $row->calendar; // Give me an Array of all the calandars we need
}
// Check to see if we need to collect the data from the cloud or if we can use the cached version
$foundEvents=[];
foreach ($checkCalandars as $checkThisCalendar){
// Print the next 7 events on the specific calendars.
$calendarId = $checkThisCalendar;
$optParams = array(
'maxResults' => 7,
'orderBy' => 'startTime',
'singleEvents' => TRUE,
'timeMin' => $checkTime
);
$results = $service->events->listEvents($calendarId, $optParams);
我只想将$ calendarId传递给API一次,让它告诉我这些日历中的所有事件,而不是一次执行一次。这可能吗?