类"Google_Config"未找到 [英] Class "Google_Config" not found

查看:74
本文介绍了类"Google_Config"未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过此处,但是由于某种原因,当我尝试运行它时,我总是得到:

I'm trying to implement Google's login API via the instructions here, but for some reason, when I try to run it, I always get:

致命错误:在第76行的/home/.../Google/Client.php中找不到类"Google_Config"

Fatal error: Class 'Google_Config' not found in /home/.../Google/Client.php on line 76

我很确定自己已正确链接到Client.php-我不认为这是我自己的代码中的问题.有人知道这里会发生什么吗?谢谢!

I'm quite sure I linked to Client.php correctly - I don't think it's a problem within my own code. Does anyone know what might be happening here? Thanks!

推荐答案

此错误表示您没有使用Composer来安装客户端. 在没有Composer的情况下,您应该在脚本中

This error means that you didn't use Composer, to install the client. Without Composer, in your script you should

set_include_path(get_include_path() . PATH_SEPARATOR . dirname($_SERVER['SCRIPT_FILENAME']) . 'vendor/google-api-php-client/src');  
require_once '/path/to/autoload.php';  
require_once '/path/to/Client.php';

没有autoload.php,将不会找到任何类.在Client.php中,类定义尝试加载autoload.php之前的代码.但是您已经通过提供完整的路径找到了Client.php.因此,那里没有发生autoload.php的加载.

Without the autoload.php, no class will be found. In Client.php the code before the Class definition tries to load autoload.php. But you have already found the Client.php, by giving the full path to it. So no loading of autoload.php happens there.

正如您所说,重新安装API时,您的问题已解决.我想您是第二次使用Composer.

As you say, your problem solved when you reinstalled the API. I suppose you used Composer the second time.

说明: 根据 google文档<.适用于"google/apiclient":"1.0.*@beta"

Clarification: The above note does NOT mean to skip proper client installation, according to google documentation. Applies for "google/apiclient": "1.0.*@beta"

这篇关于类"Google_Config"未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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