代码:
if (isset($_GET['access_token'])) {
$_SESSION['oauth'] = $_GET['access_token'];
$usernameResult = file_get_contents("https://api.twitch.tv/kraken?oauth_token=" . $_SESSION['oauth']);
$json_decoded_usernameResult = json_decode($usernameResult, true);
echo $_SESSION['username'] = $json_decoded_usernameResult['token']['user_name'];
} else {
header('Location: https://api.twitch.tv/kraken/oauth2/authorize?response_type=token&client_id={clientID}&redirect_uri=http://127.0.0.1/thebot/oauth');
}
发生的情况是我的 URL 变为“ http://127.0.0.1/thebot/oauth#access_token= {AccessToken}&scope="。不知何故“?” 替换为“#”。是否有人在我的代码中看到错误或知道解决方法,以便我可以将其切换或其他什么?