<?php
require 'openid.php';
try
{
# Change 'localhost' to your domain name.
$openid = new LightOpenID('localhost');
if(!$openid->mode)
{
if(isset($_GET['login']))
{
$openid->identity = 'https://www.google.com/accounts/o8/id';
header('Location: ' . $openid->authUrl());
}
?>
<form action="?login" method="post">
<button>Login with Google</button>
</form>
<?php
}
elseif($openid->mode == 'cancel')
{
echo 'User has canceled authentication!';
}
else
{
echo 'User ' . ($openid->validate() ? $openid->identity . ' has ' : 'has not ') . 'logged in.';
}
}
catch(ErrorException $e)
{
echo $e->getMessage();
}
有人问了这个问题,但由于缺乏测试,很大一部分没有得到回答,问题是为什么登录后不显示使用谷歌登录按钮
注意:这是openid,显示后将重定向到google,登录google后返回页面,但登录后不显示按钮,原因?