PHP - 通过composer找不到Google_DriveService

时间:2016-09-03 22:22:19

标签: php google-api google-drive-api

我已经使用composer安装google api php,并将vendor文件夹上传到我的服务器。

php composer.phar require google/apiclient:^2.0

我的代码:getVideo.php

<?
require_once __DIR__ . '/vendor/autoload.php';
define('ID_VIDEO', '0B9SXFdezvkZtOE9xVlVNR3U0a1U');
$client = new Google_Client();
$client->setApplicationName("LOAD_VIDEO");
$client->setDeveloperKey("AIzaSyD1AVpO4qBgH0JmQOEU_xxxx");
$client->addScope(Google_Service_Drive::DRIVE);
$client->setAccessType('offline_access'); 
session_start();
if (isset($_SESSION['token'])) {
 $client->setAccessToken($_SESSION['token']);
}
$service = new Google_DriveService($client);
$file = $service->files->get(ID_VIDEO);
$access_toke = json_decode($client->getAccessToken(), TRUE);
$access_toke = $access_toke['access_token'];
?>
<embed width="100%" height="100%" name="plugin" src="<?= urldecode($file['embedLink']);?>&access_token=<?= $access_toke;?>" type="application/x-shockwave-flash" >

我收到了错误代码:

  

致命错误:第18行的/home/myserver/public_html/getVideo.php中找不到“Google_DriveService”类

我在文件夹供应商中找不到google_driveservice的文件,我错过了什么吗?

1 个答案:

答案 0 :(得分:0)

查看repository班级名称为Google_Service_Drive

更新:同样根据客户readme