我从谷歌的一个服务账户的入门页面开始。但是我被这个错误困住了,她没有告诉我太多关于这个问题的信息
我还尝试了该库的2.1.3版本,得到了相同的结果。
<?php
ini_set('display_errors', 1); error_reporting(E_ALL);
require_once __DIR__ . '/../library/google-api-php-client-2.2.0/vendor/autoload.php';
putenv('GOOGLE_APPLICATION_CREDENTIALS=./../secure/some-name-v2-cad7d18fcade.json');
$client = new Google_Client();
$client->useApplicationDefaultCredentials();
$driveService = new Google_Service_Drive($client);
$fileId = "0B9w-wSwYgo9ZU0toRFc3R1A5dlG";
$optParams = array();
$response = $driveService->files->get($fileId, $optParams); // Error on this line.
var_dump($response);
?>
C: \www\library\google-api-php-client-2.2.0\vendor\firebase\php-jwt\src\jwt。菲律宾比索:196
堆栈跟踪:
#0 C:\www\library\google-api-php-client-2.2.0\vendor\firebase\php-jwt\src\jwt。菲律宾比索(167):
Firebase\JWT\JWT::sign('eyJ0eXAiOiJKV1Q…','----BEGIN PRIV….,'RS256')
#1 C:\www\library\google-api-php-client-2.2.0\vendor\google\auth\src\OAuth2。菲律宾比索(1267):
Firebase\JWT\JWT::encode(数组,'----BEGIN PRIV….,'RS256')
Google\Auth\OAuth2->jwtEncode(数组,'----BEGIN PRIV….,'RS256')
#3 C:\www\library\google-api-php-client-2.2.0\vendor\google\auth\src\OAuth2。菲律宾比索(451):
Google\Auth\OAuth2->toJwt()
#4 C:\www in C:\www\library\google-api-php-client-2.2.0\vendor\firebase\php-jwt\src\jwt。php第196行