脚本宝典收集整理的这篇文章主要介绍了php – 更新Google日历 – 致命错误:调用未定义的函数dateTime(),脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
PHP致命错误:在第45行的public_htML / googleapi / calendarupdate.PHP中调用未定义的函数dateTime().它指的是:
$event->setStart.dateTime($startdatetime);
<?PHP header('Content-tyPE: application/json'); require_once __DIR__ . '/google-api-PHP-client/src/Google/autoload.PHP'; $summary = $_POST["summary"]; $location = $_POST["location"]; $description = $_POST["description"]; $startdatetime = $_POST["startdatetime"]; $enddatetime = $_POST["enddatetime"]; $clientemail = $_POST["clientemail"]; $PRivatekey = $_POST["privatekey"]; $useremail = $_POST["useremail"]; $calendarid = $_POST["calendarid"]; $client_email = $clientemail; $private_key = file_get_contents($privatekey); $scopes = array('https://www.googleapis.COM/auth/calendar'); $user_to_impersonate = $useremail; $credentials = new Google_Auth_AssertionCredentials( $client_email,$scopes,$private_key,'notasecret',// Default P12 password 'http://oauth.net/grant_type/jwt/1.0/bearer',// Default grant type $user_to_impersonate ); $client = new Google_Client(); $client->setAssertionCredentials($credentials); if ($client->getAuth()->isAccessTokenExpired()) { $client->getAuth()->refreshTokenWIThAssertion(); } $service = new Google_Service_Calendar($client); $event = $service->events->get($useremail,$calendarid); $event->setSummary($summary); $event->setLocation($location); $event->setStart.dateTime($startdatetime); $event->setStart.timeZone('america/Los_Angeles'); $event->setEnd.dateTime($enddatetime); $event->setEnd.timeZone('America/Los_Angeles'); $event->setDescription($description); $updatedEvent = $service->events->update($useremail,$event->getId(),$event); echo json_encode($updatedEvent);
以上是脚本宝典为你收集整理的php – 更新Google日历 – 致命错误:调用未定义的函数dateTime()全部内容,希望文章能够帮你解决php – 更新Google日历 – 致命错误:调用未定义的函数dateTime()所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。