Google API PHP客户端-加载控制器页面时出错 [英] Google api php client - error on loading controller page

查看:66
本文介绍了Google API PHP客户端-加载控制器页面时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了网站中的示例。

I have used example from this site.

我刚刚添加了凭据和以下行:

I have just added the credentials and the line:

require_once APPPATH . "libraries/google-api-php-client-master/src/Google/autoload.php";

在控制器中。

以下错误:


致命错误:未捕获的异常 Exception,消息为此库
必须通过作曲者或通过下载完整的软件包。请参阅
中的说明
https://github.com / google / google-api-php-client#installation 。中
/ var / www / html / gauth / application / libraries / google-api-php-client-master / src / Google / autoload.php:14
堆栈跟踪:#0
/var/www/html/gauth/application/controllers/user_authentication.php(15):
require_once()#1 [内部函数]:User_Authentication-> index()#2
/var/www/html/gauth/system/core/CodeIgniter.php(360):
call_user_func_array(Array,Array)#3
/var/www/html/gauth/index.php(202):require_once('/ var / www / html / g ...')
#4 {main}放在/ var / www / html /中gauth / application / libraries / google-api-php-client-master / src / Google / autoload.php
在第14行

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.' in /var/www/html/gauth/application/libraries/google-api-php-client-master/src/Google/autoload.php:14 Stack trace: #0 /var/www/html/gauth/application/controllers/user_authentication.php(15): require_once() #1 [internal function]: User_Authentication->index() #2 /var/www/html/gauth/system/core/CodeIgniter.php(360): call_user_func_array(Array, Array) #3 /var/www/html/gauth/index.php(202): require_once('/var/www/html/g...') #4 {main} thrown in /var/www/html/gauth/application/libraries/google-api-php-client-master/src/Google/autoload.php on line 14

请帮助,这是我第一次这样做!

Please help, I am doing this for the first time!

推荐答案

这是因为您的项目缺少lib google-api-php-cli ent ,建议您通过作曲家进行安装。

It is because your project missed the lib google-api-php-client,suggest you install it via composer.


  • 安装作曲家(如果您没有)

  • 将google-api-php-client lib添加到您的项目中

  • 重新运行您的代码


  • php -r readfile(' https://getcomposer.org/installer '); > composer-setup.php
    php -r if(hash('SHA384',file_get_contents('composer-setup.php'))==='fd26ce67e3b237fffd5e5544b45b0d92c41a4afe3e3f3e778e942e43ce6be197b9cdc7269 echo'安装程序损坏'; unlink('composer-setup.php');}
    php composer-setup.php
    php -r unlink('composer-setup.php');

  • php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php php -r "if (hash('SHA384', file_get_contents('composer-setup.php')) === 'fd26ce67e3b237fffd5e5544b45b0d92c41a4afe3e3f778e942e43ce6be197b9cdc7c251dcde6e2a52297ea269370680') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); }" php composer-setup.php php -r "unlink('composer-setup.php');"

composer需要google / apiclient:^2.0.0@RC

  • composer
  • google-api-php-client

这篇关于Google API PHP客户端-加载控制器页面时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆