dqhbuwrwq692118284 2016-12-13 22:15
浏览 76
已采纳

API Youtube - >致命错误:找不到类'Google_Service'

I'm getting an error in php, when I try to include the google api php client as follow:

require_once '\google-api-php-client-master\src\Google\Client.php';
require_once '\google-api-php-client-master\src\Google\Service\youtube.php';

Likewise, I try to include autoload.php file as follow:

require_once '\google-api-php-client-master\src\Google\autoload.php';

But a different error appears:

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

The codes that I am trying to test appear in the following link:

Https://developers.google.com/youtube/v3/code_samples/php

PD: sorry for my bad english

  • 写回答

2条回答 默认 最新

  • dqndc26628 2016-12-14 09:49
    关注

    The error is more specific to PHP rather than this specific package.

    You cannot use a PHP package just by downloading it. You need to install it and you may use any other package manager instead of composer as you wish.

    You need to composer install the package google/apiclient.

    In short, the file composer.json should include the following code snippet:

    "require": {
        "google/apiclient": "2.0.*",
        "php": ">= 5.6.1"
     }
    

    Once you ensure that you have the above snippet, run the following command:

    composer install

    After this, the error should not occur.

    Hope this helps.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Stata链式中介效应代码修改
  • ¥15 latex投稿显示click download
  • ¥15 请问读取环境变量文件失败是什么原因?
  • ¥15 在若依框架下实现人脸识别
  • ¥15 添加组件无法加载页面,某块加载卡住
  • ¥15 网络科学导论,网络控制
  • ¥100 安卓tv程序连接SQLSERVER2008问题
  • ¥15 利用Sentinel-2和Landsat8做一个水库的长时序NDVI的对比,为什么Snetinel-2计算的结果最小值特别小,而Lansat8就很平均
  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用