我在我的应用程序中忽略了这个问题一段时间,几乎错过了你的解决方案,因为它在评论中。
可以在处理程序的第一部分应用“修复”,而无需实际修改 LightOpenId 代码,因此:
$mysiteurl = 'https://my.site.url/'; // note trailing '/' included
$openid = new LightOpenID($mysiteurl); // <- the trailing '/' onwards is stripped internally
if (!$openid->mode) {
$openid->required = array(
'namePerson/first',
'namePerson/last'
// etc...
);
// redirects to google openid provider
$openid->identity = 'https://www.google.com/accounts/o8/id';
$openid->realm = $mysiteurl; // <- ADD THIS LINE - resets realm with the trailing '/'
header('Location: ' . $openid->authUrl());
return;
} elseif ($openid->mode == 'cancel') {
header('Location: '. $mysiteurl.'cancelled.php');
return;
} elseif (!$openid->validate()) {
header('Location: '. $mysiteurl.'failed.php');
return;
}
header('Location: '. $mysiteurl.'success.php');
return;