• <bdo id='7G3Qi'></bdo><ul id='7G3Qi'></ul>

  • <i id='7G3Qi'><tr id='7G3Qi'><dt id='7G3Qi'><q id='7G3Qi'><span id='7G3Qi'><b id='7G3Qi'><form id='7G3Qi'><ins id='7G3Qi'></ins><ul id='7G3Qi'></ul><sub id='7G3Qi'></sub></form><legend id='7G3Qi'></legend><bdo id='7G3Qi'><pre id='7G3Qi'><center id='7G3Qi'></center></pre></bdo></b><th id='7G3Qi'></th></span></q></dt></tr></i><div id='7G3Qi'><tfoot id='7G3Qi'></tfoot><dl id='7G3Qi'><fieldset id='7G3Qi'></fieldset></dl></div>

      <legend id='7G3Qi'><style id='7G3Qi'><dir id='7G3Qi'><q id='7G3Qi'></q></dir></style></legend>

      <small id='7G3Qi'></small><noframes id='7G3Qi'>

        <tfoot id='7G3Qi'></tfoot>

        实现 Oauth2 登录,致命错误:找不到“Google_Servic

        时间:2023-10-02

        1. <tfoot id='pGKCL'></tfoot>
          <i id='pGKCL'><tr id='pGKCL'><dt id='pGKCL'><q id='pGKCL'><span id='pGKCL'><b id='pGKCL'><form id='pGKCL'><ins id='pGKCL'></ins><ul id='pGKCL'></ul><sub id='pGKCL'></sub></form><legend id='pGKCL'></legend><bdo id='pGKCL'><pre id='pGKCL'><center id='pGKCL'></center></pre></bdo></b><th id='pGKCL'></th></span></q></dt></tr></i><div id='pGKCL'><tfoot id='pGKCL'></tfoot><dl id='pGKCL'><fieldset id='pGKCL'></fieldset></dl></div>

                <bdo id='pGKCL'></bdo><ul id='pGKCL'></ul>
              • <legend id='pGKCL'><style id='pGKCL'><dir id='pGKCL'><q id='pGKCL'></q></dir></style></legend>
                  <tbody id='pGKCL'></tbody>
                1. <small id='pGKCL'></small><noframes id='pGKCL'>

                  本文介绍了实现 Oauth2 登录,致命错误:找不到“Google_Service"类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在将我网站的登录系统从 LightOpenID 更新为 Google 的 Oauth 2.0.

                  I am updating my website's login system from LightOpenID to Google's Oauth 2.0.

                  当我需要 Client.php 和 Service/Oauth2.php 时出现错误

                  When I require the Client.php and the Service/Oauth2.php I get an error

                  致命错误:在第 32 行的/home/myname/repos/website_current/lib/google-api-php-client/src/Google/Service/Oauth2.php 中找不到Google_Service"类

                  Fatal error: Class 'Google_Service' not found in /home/myname/repos/website_current/lib/google-api-php-client/src/Google/Service/Oauth2.php on line 32

                  我使用的代码(来自我的 login.php 文件)看起来像这样

                  The code I am using (from my login.php file) looks like this

                  require_once(dirname($_SERVER['DOCUMENT_ROOT']).'/lib/autoload.php');
                  require('Google/Client.php');
                  require('Google/Service/Oauth2.php');
                  echo "exit";
                  exit();
                  

                  我在 PHP.ini(在/etc/php5/apache2/php.ini 中)添加了包含路径

                  I have added the include path in the PHP.ini (in /etc/php5/apache2/php.ini) as

                  include_path = ".:/usr/local/lib/php:/home/myname/repos/website_current/lib/google-api-php-client/src"
                  

                  所以它似乎我的 Oauth2.php 文件看不到任何其他包含,包括类Google_Service",它是Service.php"中的一个文件夹.

                  So its seems my Oauth2.php file can't see any of the other includes including the class 'Google_Service' which is one folder up in 'Service.php'.

                  我的文件夹结构如下:

                  lib/
                  ... autoload.php
                  ... functions.php
                  ... google-api-php-client/
                      ... src/
                          ... Google/ (etc etc)
                  public_html/
                  ... login/
                      ...login.php
                  

                  我不知道为什么会发生这种情况.应该可以看到包含路径,并使用 phpinfo() 显示为包含路径;有人可以给我一些见解吗?

                  I have no idea why this is occuring. The include path should be seen, and shows up as an included path using phpinfo(); Can someone please give me some insight?

                  推荐答案

                  确保您在任何其他 Googlerequire_once"行BEFORE之前添加该行.

                  Make sure you add the line BEFORE any other Google "require_once" lines.

                  require_once 'google-api-php-client/autoload.php';
                  

                  我最后吃了它,它让我挠了 10 分钟.

                  I had it last and it had me scratching my head for a good 10 minutes.

                  这篇关于实现 Oauth2 登录,致命错误:找不到“Google_Service"类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何使用带有自定义用户名列的 Laravel Passport 下一篇:从 Google OAuth 2.0 PHP API 获取用户信息

                  相关文章

                  最新文章

                  <small id='x2EwA'></small><noframes id='x2EwA'>

                2. <legend id='x2EwA'><style id='x2EwA'><dir id='x2EwA'><q id='x2EwA'></q></dir></style></legend>
                    • <bdo id='x2EwA'></bdo><ul id='x2EwA'></ul>

                    <i id='x2EwA'><tr id='x2EwA'><dt id='x2EwA'><q id='x2EwA'><span id='x2EwA'><b id='x2EwA'><form id='x2EwA'><ins id='x2EwA'></ins><ul id='x2EwA'></ul><sub id='x2EwA'></sub></form><legend id='x2EwA'></legend><bdo id='x2EwA'><pre id='x2EwA'><center id='x2EwA'></center></pre></bdo></b><th id='x2EwA'></th></span></q></dt></tr></i><div id='x2EwA'><tfoot id='x2EwA'></tfoot><dl id='x2EwA'><fieldset id='x2EwA'></fieldset></dl></div>
                    1. <tfoot id='x2EwA'></tfoot>