require_once(Google/Auth/AssertionCredentials.php):无法打开流:没有这样的文件或目录

Nic*_*olò 2 google-api-php-client

我想做一个非常简单的事情:

require_once 'vendor/google/src/Google/Client.php';
require_once 'vendor/google/src/Google/Service/Plus.php';
Run Code Online (Sandbox Code Playgroud)

......我收到这个错误:

require_once(Google/Auth/AssertionCredentials.php): failed to open stream: No such file or directory
Run Code Online (Sandbox Code Playgroud)

为什么?

我正在使用https://github.com/google/google-api-php-client上提供的最新版本,似乎在Client.php中,每个require_once都使用错误的路径......或者不是?

任何帮助将不胜感激!

非常感谢,
Niccolò

Dam*_*gni 7

对于您的问题,您需要在php'include_path'中添加库的基目录.

尝试在require_once之前放置这行代码

set_include_path( get_include_path() . PATH_SEPARATOR . 'vendor/google/src' );
Run Code Online (Sandbox Code Playgroud)