0
使用下面的代碼:谷歌的API的PHP客戶端 - 獲取文件內容
// get the file contents
$file = new Google_Service_Drive_DriveFile();
$fileId = 'The File ID';
try {
echo 'try part <br>';
$result3 = $service->files->get($fileId);
echo 'Contents: ' . $result3->getContent().'<br>';
echo "Title: " . $result3->getTitle() . '<br>';
echo "Description: " . $result3->getDescription() . '<br>';
echo "MIME type: " . $result3->getMimeType() . '<br>';
} catch (Exception $e) {
echo "An error occurred: " . $e->getMessage();
};
一切正常,除了這行:
echo 'Contents: ' . $result3->getContent().'<br>';
在drive.php文件中的API,有一個getContent()
函數,但它不起作用。如何從文件中獲取內容?
看起來像那樣選項使用API'Google_Http_Request'類。看過Google_Service_Drive_DriveFile類代碼後,我意識到它只獲取元數據。 –