1 回答

TA貢獻1869條經驗 獲得超4個贊
以下按預期工作:
$event = [
'start' => "2019-07-01T00:00:00+08:00",
'end' => "2019-07-16T00:00:00+08:00",
'title' => "Google Sync Weekly 4",
'description' => "Google Sync Weekly 4",
'recurrence' => "RRULE:FREQ=WEEKLY;UNTIL=20190716T000000Z",
];
$event = new Google_Service_Calendar_Event(array(
'summary' => $event['title'],
'location' => !empty($event['location']) ? $event['location'] : '',
'description' => $event['description'],
'start' => array(
'dateTime' => $event['start'],
'timeZone' => 'Asia/Taipei',
),
'end' => array(
'dateTime' => $event['end'],
'timeZone' => 'Asia/Taipei',
),
'recurrence' => !empty($event['recurrence']) ? [$event['recurrence']] : [],
'reminders' => array(
'useDefault' => FALSE,
'overrides' => array(
array('method' => 'email', 'minutes' => 24 * 60),
array('method' => 'popup', 'minutes' => 10),
),
),
));
$service = new Google_Service_Calendar($client);
$service->events->insert('primary', $event);
問題是,正如錯誤消息所暗示的那樣,您的重復規則格式不正確。規則應該以 為前綴,RRULE:并且必須遵循RFC 5545 中規定的規則。請密切注意有關時間戳和時區的部分。可以在API 文檔站點的“創建重復事件”代碼片段中找到格式正確的規則的基本示例。
您還可以從日歷 UI 創建一個循環,并通過 API 獲取它以獲取其他更定制的示例。
- 1 回答
- 0 關注
- 152 瀏覽
添加回答
舉報