我在一个网站上工作,并使用steam openid,至今没有问题。 问题是,当我试图将用户重定向到蒸汽开放页面时,它不起作用,并将它们重定向到steamcommunity.com的根目录。
下面是代码:
if (!isset($_SESSION['steamid']) && $_GET['a'] == "login") {
$url = SteamSignIn::genUrl($_AMCFG['login_dir']);
print($url);
header("Location: ".$url);
}
手动输入,但重定向正如我所说的,不是那么好当生成的URL完美的作品。 我试图手动替换标头中的$ url,它工作正常。
header('Location: https://steamcommunity.com/openid/login?openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.mode=checkid_setup&openid.return_to=http%3A%2F%2Flocalhost%2Fadminmailer%2Findex.php&openid.realm=http%3A%2F%2Flocalhost&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select');
我很困惑,为什么这不按预期工作。
作为一个临时的解决办法我已经加入这个头:
<?php
if (isset($_GET['a'])) {
if (!isset($_SESSION['steamid']) && $_GET['a'] == "login") {
$url = SteamSignIn::genUrl($_AMCFG['login_dir']);
?><meta http-equiv="refresh" content="0; url=<?php print($url); ?>" /><?php
}
}
?>
那么,什么是“不那么好”呢?怎么了?你有没有检查过它不是Steam最终重定向你? – ceejayoz 2014-11-02 13:56:53
你不应该在更改标题前打印 – 2014-11-02 13:57:49
正如我所说的,它将我重定向到没有/ openid的steamcommunity.com的根目录... – Starfox64 2014-11-02 13:58:31