Google drive api GoogleDriveSDK-Php客户端库-下载一个可以找到类的文件?
我尝试用这种方法下载一个文件Google drive api GoogleDriveSDK-Php客户端库-下载一个可以找到类的文件?,google-drive-api,Google Drive Api,我尝试用这种方法下载一个文件 /** * Download a file's content. * * @param Google_DriveService $service Drive API service instance. * @param File $file Drive File instance. * @return String The file's content if successful, null otherwise. */ function download
/**
* Download a file's content.
*
* @param Google_DriveService $service Drive API service instance.
* @param File $file Drive File instance.
* @return String The file's content if successful, null otherwise.
*/
function downloadFile($service, $file) {
$downloadUrl = $file->getDownloadUrl();
if ($downloadUrl) {
$request = new Google_HttpRequest($downloadUrl, 'GET', null, null);
$httpRequest = Google_Client::$io->authenticatedRequest($request);
if ($httpRequest->getResponseHttpCode() == 200) {
return $httpRequest->getResponseBody();
} else {
// An error occurred.
return null;
}
} else {
// The file doesn't have any content stored on Drive.
return null;
}
}
在那里找到:
但我不知道在图书馆的什么地方可以找到我需要包含的两个类:
- Google\u HttpRequest
- 谷歌客户端