Php 从OpenID2.0迁移到OpenIDConnect

Php 从OpenID2.0迁移到OpenIDConnect,php,openid,google-openid,openid-connect,Php,Openid,Google Openid,Openid Connect,正如我们所知,Google登录正在从OpenId2.0迁移到OpenIDConnect。我已经像以前一样更改了代码 require 'oauth/openid.php'; $openid = new LightOpenID; $openid->realm = "http://".$_SERVER[HTTP_HOST]; $openid->identity = 'https://www.google.com/accounts/o8/id'; $openid->req

正如我们所知,Google登录正在从OpenId2.0迁移到OpenIDConnect。我已经像以前一样更改了代码

require 'oauth/openid.php';
$openid = new LightOpenID;

  $openid->realm = "http://".$_SERVER[HTTP_HOST];
  $openid->identity = 'https://www.google.com/accounts/o8/id';
  $openid->required = array('contact/email');
  if (!headers_sent()){
       header('Location: '.$openid->authUrl());
  }else{
       echo '<script type="text/javascript">';
       echo 'window.location.href="'.$openid->authUrl().'";';
       echo '</script>';
   }
        }
需要'oauth/openid.php';
$openid=新的LightOpenID;
$openid->realm=“http://”$\u服务器[http\u主机];
$openid->identity=https://www.google.com/accounts/o8/id';
$openid->required=array('contact/email');
如果(!headers_sent()){
标题('Location:'。$openid->authUrl());
}否则{
回声';
echo'window.location.href=“”。$openid->authUrl()”;
回声';
}
}

但是它抛出了一个错误,比如
发送的无效参数
。是否需要添加/更改任何内容?

此代码还有其他内容吗?我看不到这个对象的实例化。@哈尔弗我已经完成了你的
HTTP\u主机
应该用引号括起来。如果您看不到由此生成的通知,则可能会在开发环境中关闭错误。试着打开它们,看看你是否还遗漏了什么?@halfer从openId2.0迁移到connect时,我是否需要添加其他内容?比如openid或其他任何东西..如果你知道的任何网站解释了每个步骤,而不是谷歌开发者网站?@Gautam3164如果你想将数据发送到javascript,请始终使用json_编码。顺便问一下,还有答案吗?