我正在将我的网站登录系统从LightOpenID更新为Google的Oauth 2.0.
当我需要Client.php和Service/Oauth2.php时,我收到错误
致命错误:第32行/home/myname/repos/website_current/lib/google-api-php-client/src/Google/Service/Oauth2.php中未找到"Google_Service"类
我正在使用的代码(来自我的login.php文件)看起来像这样
require_once(dirname($_SERVER['DOCUMENT_ROOT']).'/lib/autoload.php');
require('Google/Client.php');
require('Google/Service/Oauth2.php');
echo "exit";
exit();
Run Code Online (Sandbox Code Playgroud)
我在PHP.ini中添加了include路径(在/etc/php5/apache2/php.ini中)
include_path = ".:/usr/local/lib/php:/home/myname/repos/website_current/lib/google-api-php-client/src"
Run Code Online (Sandbox Code Playgroud)
所以它似乎我的Oauth2.php文件看不到任何其他包括类'Google_Service',这是'Service.php'中的一个文件夹.
我的文件夹结构如下所示:
lib/
... autoload.php
... functions.php
... google-api-php-client/
... src/
... Google/ (etc etc)
public_html/
... login/
...login.php
Run Code Online (Sandbox Code Playgroud)
我不知道为什么会这样.应该看到包含路径,并使用phpinfo()显示为包含的路径; 有人可以给我一些见解吗?