1

我正在我的网站中使用 PHP 实现 OpenID。我写的代码如下...

<?php
    session_start();
    require_once('openid.php');
    try 
    {
        # Change 'localhost' to your domain name.
        $openid = new LightOpenID('openid.ch.net16.com');
            $openid->required = array(
            'namePerson',
            'namePerson/first',
            'namePerson/last',
            'contact/email',
            );

        $openid->identity = 'https://www.google.com/accounts/o8/id';
        $openid->returnUrl = 'http://www.openid.ch.net16.com/home.php';
        if(!$openid->mode) 
        {
            $_SESSION['auth']="Google";
            header('Location: ' . $openid->authUrl());
        }
        else 
        {
                echo 'User has canceled authentication!';
        }
    }
    catch(ErrorException $e) 
    {
        echo $e->getMessage();
    }
?>

但谷歌说如下......

错误:invalid_request
解析 OpenID 身份验证请求时出错。
学到更多

请帮我解决这个问题............

4

0 回答 0