API Youtube-->Fatal error: Class 'Google_Service' not found in
API Youtube-->Fatal error: Class 'Google_Service' not found in
我在 php 中遇到错误,当我尝试包含 google api php 客户端时,如下所示:
require_once '\google-api-php-client-master\src\Google\Client.php';
require_once '\google-api-php-client-master\src\Google\Service\youtube.php';
同样,我尝试包含 autoload.php 文件如下:
require_once '\google-api-php-client-master\src\Google\autoload.php';
但是出现了不同的错误:
Fatal error: Uncaught exception 'Exception' with message '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
我要测试的代码出现在下面link:
Https://developers.google.com/youtube/v3/code_samples/php
PD:抱歉我的英语不好
如果完整包不起作用,请尝试按照错误中的建议使用作曲家。您可以在此 tutorial and this SO question 中找到有关如何使用 composer 的信息。
错误更具体到 PHP 而不是这个特定的包。
您不能仅通过下载来使用 PHP 包。您需要安装它,您可以根据需要使用任何其他包管理器而不是 composer
。
您需要 composer install
包 google/apiclient
。
简而言之,文件 composer.json
应包含以下代码段:
"require": {
"google/apiclient": "2.0.*",
"php": ">= 5.6.1"
}
一旦你确定你有上面的片段,运行下面的命令:
composer install
此后应该不会出现错误了。
希望对您有所帮助。
我在 php 中遇到错误,当我尝试包含 google api php 客户端时,如下所示:
require_once '\google-api-php-client-master\src\Google\Client.php';
require_once '\google-api-php-client-master\src\Google\Service\youtube.php';
同样,我尝试包含 autoload.php 文件如下:
require_once '\google-api-php-client-master\src\Google\autoload.php';
但是出现了不同的错误:
Fatal error: Uncaught exception 'Exception' with message '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
我要测试的代码出现在下面link:
Https://developers.google.com/youtube/v3/code_samples/php
PD:抱歉我的英语不好
如果完整包不起作用,请尝试按照错误中的建议使用作曲家。您可以在此 tutorial and this SO question 中找到有关如何使用 composer 的信息。
错误更具体到 PHP 而不是这个特定的包。
您不能仅通过下载来使用 PHP 包。您需要安装它,您可以根据需要使用任何其他包管理器而不是 composer
。
您需要 composer install
包 google/apiclient
。
简而言之,文件 composer.json
应包含以下代码段:
"require": {
"google/apiclient": "2.0.*",
"php": ">= 5.6.1"
}
一旦你确定你有上面的片段,运行下面的命令:
composer install
此后应该不会出现错误了。
希望对您有所帮助。