这可能是一个简单的问题。我正在使用Pathogen-David身份验证代码的修改。我尝试echo
用户帐户名但没有成功。任何帮助都会非常好。
我试过这个
$name = $response->name;// Does not work, returns blank
$name = $response["name"];// Does not work, returns blank
代码
[...rest of code]
else{
$params = array("code" => $_GET["code"], "redirect_uri" => $redirecturi);
$response = $client->getAccessToken($accessTokenUrl, "authorization_code", $params);
$accessTokenResult = $response["result"];
$client->setAccessToken($accessTokenResult["access_token"]);
$client->setAccessTokenType(OAuth2\Client::ACCESS_TOKEN_BEARER);
$response = $client->fetch("https://oauth.reddit.com/api/v1/me");
$name = $response->name;//does not work return blank
$name = $response["name"];//does not work return blank
echo $name;
}