我的微信授權登錄采用靜默授權但跳轉後是個空白頁面請問各位大神是怎麼回事?,求給個建議
/**
* 通過oauth2.0獲取openid
* 若只需要獲取用戶openid,調用次方法,若需要獲取用戶所有信息,請調用getOpenidByOauth2()方法
*/
protected function getOpenidByOauth() {
$wx_info = $this->wx_info;
// 獲取openid
if (!$openid) {
if (!isset($_GET['code'])) {
$customeUrl = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$scope = 'snsapi_base';
$oauthUrl = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' . $wx_info['appid'] . '&redirect_uri=' . urlencode($customeUrl) . '&response_type=code&scope=' . $scope . '&state=oauth#wechat_redirect';
header('Location:' . $oauthUrl);
exit();
}else{
$url = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid=' . $wx_info['appid'] . '&secret=' . $wx_info['appsecret'] . '&code=' . $_GET['code'] . '&grant_type=authorization_code';
$result = json_decode(curlGet($url), true);
$openid = $result['openid'];
}
}