PHP谷歌日历API v2.6-updateEvent()函数


PHP Google Calendar API v2.6 - updateEvent() function

我为Google Calendar API(v2.6)找到了一个简单的PHP类

https://github.com/montania/Google-Calendar-API-PHP-Class

还有函数updateEvent($handle,$id,$etag,$json){…}

/**
* Method to update an event in the calendar. 
  If $etag is submitted it won't update your event if it has been updated since 
  you last retreived it
* @param string $handle    E-mail or handle to identify the calendar
* @param string $id        The id of the event
* @param string $etag      The e-tag of the event (optional)
* @param string $json      The complete json code from the event that you've 
                           retrieved with the changes that you want
* @return bool|object      Returns false on failure and object on success
*/ 

我应该在$json参数中放入什么?有人能给我举个代码示例吗?

谢谢。

$json参数应该包括json格式的编辑事件,该事件来自检索日历事件时得到的响应。

这是您需要采取的步骤,以便能够更新事件

  1. 使用getEvents()或getEvent()方法从日历中获取当前事件
  2. 更新返回对象的属性以反映要对事件进行的更改
  3. 使用JSON_Encode()将对象编码为JSON格式,并将其传递回updateEvent()方法

Google日历API文档也解释了这一点:http://code.google.com/apis/calendar/data/2.0/developers_guide_protocol.html#UpdatingEvents