Yii和Google Api PHP客户端


Yii and Google Api PHP Client

我需要将Google Api PHP客户端添加到我的Yii 1.1项目中
我是Yii的新手,但我已经用过这个图书馆了
如何导入此(whithout composer)?

我将尝试将谷歌api php客户端放在供应商文件夹中,并添加这行

Yii::import('application.vendor.*');
require_once('google-api-php-client/src/Google/Client.php');

但当我使用:

$client = new Google_Client();

我得到了这个错误:

include(Google_Config.php): failed to open stream: No such file or directory

我该如何解决
非常感谢。

正确的路径是

Yii::import('application.vendor.*');
require_once('google/apiclient/src/Google/Client.php');

您应该始终使用__DIR__魔术常量。它允许您使用当前文件作为基本位置来处理文件。

http://php.net/manual/en/language.constants.predefined.php

很可能这就是你遇到的。