亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

重復規則無效?

重復規則無效?

PHP
海綿寶寶撒 2021-11-13 16:35:20
這是我使用cURL以下方法傳遞給 Google Calendar API 的有效負載:["start"]=>  string(25) "2019-07-01T00:00:00+08:00"  ["end"]=>  string(25) "2019-07-16T00:00:00+08:00"  ["title"]=>  string(20) "Google Sync Weekly 4"  ["description"]=>  string(20) "Google Sync Weekly 4"  ["recurrence"]=>  string(44) "RRULE=WEEKLY;UNTIL=2019-07-16T00:00:00+08:00"在 my 中new_event.php,我在其中處理此有效負載:$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),              ),            ),          ));這是值:["recurrence"]=>  array(1) {    [0]=>    string(44) "RRULE=WEEKLY;UNTIL=2019-07-16T00:00:00+08:00"  }我無法弄清楚我在這里做錯了什么。任何提示?
查看完整描述

1 回答

?
MMTTMM

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 獲取它以獲取其他更定制的示例。


查看完整回答
反對 回復 2021-11-13
  • 1 回答
  • 0 關注
  • 152 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號