且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

类"Google_Config"未找到

更新时间:2022-11-06 14:15:16

此错误表示您没有使用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"