我下载了光电网(http://gitorious.org/light openid),但几天前停止了工作。 我的法典:
<?php
require openid.php ;
try {
if(!isset($_GET[ openid_mode ])) {
if(isset($_GET[ login ])) {
$openid = new LightOpenID( my-domain.com );
$openid->identity = https://www.google.com/accounts/o8/id ;
$openid->required = array( namePerson/friendly , contact/email );
header( Location: . $openid->authUrl());
}
?>
<form action="?login" method="post">
<button>Login with Google</button>
</form>
<?php
} elseif($_GET[ openid_mode ] == cancel ) {
echo User has canceled authentication! ;
} else {
$openid = new LightOpenID( my-domain.com );
echo User . ($openid->validate() ? $openid->identity . has : has not ) . logged in. ;
}
} catch(ErrorException $e) {
echo $e->getMessage();
}
echo <pre> .print_r($openid,true). </pre> ;
?>
在当地举办,它虽然不是在网络服务器上运行。
Edit:我发现光电网的旧版本,并投入使用。