我在Laravel中遇到错误:
Class 'Google_FreeBusyRequest' not found
但是我在开始控制器上添加了代码:
use Google_FreeBusyRequest;
use Google_FreeBusyRequestItem;
两个班都有错误。
在这堂课之前全部工作:
$client = new Google_Client();
$client->setAuthConfig(__DIR__.'client_secret.json');
$client->addScope(Google_Service_Calendar::CALENDAR);
$client->setRedirectUri('http://' . $_SERVER['HTTP_HOST'] . '/oauth2calendar');
$client->setAccessType("offline");
$client->setAccessToken($access);
$calendar_service = new Google_Service_Calendar($client);
$freebusy_req = new Google_FreeBusyRequest();//crash
$freebusy_req->setTimeMin(date(DateTime::ATOM, strtotime("2017-02-21 08:00:00")));
$freebusy_req->setTimeMax(date(DateTime::ATOM, strtotime("2017-02-21 23:00:00")));
$item = new Google_FreeBusyRequestItem();//crash
$item->setId('primary');
$freebusy_req->setItems(array($item));
$query = $calendar_service->freebusy->query($freebusy_req);
dd($query);
为什么?