Google PHP API 客户端请求失败(不使用 Composer)

Google PHP API Client Require Fail (Without using Composer)

我从这里 https://github.com/googleapis/google-api-php-client 下载了 Google API 库。我将其解压缩并上传到我的服务器“/etc/”。然后我将路径放在我的脚本中:

require_once '/var/www/html/example.com/etc/google-api-php-client-master/src/Google/autoload.php';

这完全符合该页面上的文档:

you can download the package in its entirety. The Releases page lists all stable versions. Download any file with the name google-api-php-client-[RELEASE_NAME].zip for a package including this library and its dependencies.

Uncompress the zip file you download, and include the autoloader in your project:

require_once '/path/to/google-api-php-client/vendor/autoload.php';

服务器错误日志:

PHP Fatal error: Uncaught Exception: This library must be installed via composer or by downloading the full package. See the instructions at https://github.com/google/google-api-php-client#installation. in /var/www/html/example.com/etc/google-api-php-client-master/src/Google/autoload.php:14\nStack trace:\n#0 /var/www/html/example.com/etc/google_validate.php(2): require_once()\n#1 {main}\n thrown in /var/www/html/example.com/etc/google-api-php-client-master/src/Google/autoload.php on line 14, referer: https://chris-dev2.jove.com/etc/google.html

难道我做的不是download the package in its entirety

转到 releases 页面,滚动到最新版本的底部并下载 .zip 资产。不要选择 PHP54 文件,除非您明确使用 PHP 5.4.

提取存档,将其移动到您的项目,并包含 API 客户端存档中的 vendor/autoload.php 文件。

(如果你会用Composer,体验会更好!)