要求使用google api php库无法使用路径

时间:2014-09-19 16:52:20

标签: php require google-api-php-client

我的问题是下一个,

我尝试将使用OAuth 2.0功能的google登录集成到我的公司后端。

我在我的域名www.gabrielestevez.com上测试过,这里的一切都很完美,需求路径没有问题,一切都很顺利

但是,公司后端目录具有以下结构 enter image description here

我使用的是我开发的mvc框架,Google_SL.php文件包含我在前两个中创建的类require_once

require_once 'Google/Client.php';
require_once 'Google/Service/Oauth2.php';

工作正常,但是当它转到client.php并尝试加载此类

require_once 'Google/Auth/AssertionCredentials.php'; 

无效,这是错误 脚本中出现错误' /home/xxx/public_html/admin/hmf/Core/library/auth/Google/Client.php'第18行:require_once(Google / Auth / AssertionCredentials.php)[function.require-once]:无法打开流:没有这样的文件或目录 日期/时间:9-19-2014 11:50:29

,我不想手动更改此库中的所有路径,因为我知道必须有更好的解决方案

任何意见都表示赞赏。

2 个答案:

答案 0 :(得分:1)

供将来参考

我使用此修复了我的问题 set_include_path($ _ SERVER [' DOCUMENT_ROOT']。' / admin / hmf / Core / library / auth /' .PATH_SEPARATOR.get_include_path());

答案 1 :(得分:0)

尝试使用__DIR__获取脚本的当前目录。不完全确定AssertionCredentials.php的位置,但尝试类似

的内容
require_once(__DIR__ . '/Google/Auth/AssertionCredentials.php');