我正在尝试获取日历的可用事件颜色,我收到此错误:
PHP致命错误:调用未定义的方法Google_Service_Calendar_Colors_Resource :: getEvent()
从此代码的最后一行:
$client = new Google_Client();
$client->setClientId($configArray['google']['calsync']['client_id']);
$client->setClientSecret($configArray['google']['calsync']['client_secret']);
$client->setRedirectUri($configArray['google']['calsync']['redirect_uri']);
$client->setUseBatch(true);
$client->setScopes('calendar');
$client->setAccessToken("ACCESSTOKEN");
$cal_client = new Google_Service_Calendar($client);
$colors = $cal_client->colors->get();
$event_colors = $colors->getEvent();
为什么会这样?我该怎么做才能发现这个错误?我正在关注使用的示例:https://developers.google.com/google-apps/calendar/v3/reference/colors/get
答案 0 :(得分:0)
我弄明白了这个问题。以下代码将客户端设置为批处理请求导致致命错误。这段代码:
$client->setUseBatch(true);
不应该出现,或者应该是:
$client->setUseBatch(false);