【发布时间】:2014-09-06 20:01:57
【问题描述】:
我想在我的 Laravel 项目中使用 Google Drive API 来存储 PDF。不幸的是,示例代码是针对普通 PHP 的,我不知道如何在 Laravel 中实现它。
<?php
require_once 'Google/Client.php';
require_once 'Google/Service/Books.php';
$client = new Google_Client();
$client->setApplicationName("Client_Library_Examples");
$client->setDeveloperKey("YOUR_APP_KEY");
$service = new Google_Service_Books($client);
$optParams = array('filter' => 'free-ebooks');
$results = $service->volumes->listVolumes('Henry David Thoreau', $optParams);
foreach ($results as $item) {
echo $item['volumeInfo']['title'], "<br /> \n";
}
我想我必须在我的依赖项中包含https://github.com/google/google-api-php-client,但我不知道如何访问 API 的功能。
谁能帮帮我?
问候和感谢。
【问题讨论】:
标签: php api laravel google-drive-api