From 99b433b00dc7244679612ab37acca427a0706304 Mon Sep 17 00:00:00 2001 From: shinn lancelot <945226793@qq.com> Date: Wed, 18 Jul 2018 10:44:07 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=AE=8C=E5=96=84demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/index.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/demo/index.php b/demo/index.php index ceab537..295d94a 100644 --- a/demo/index.php +++ b/demo/index.php @@ -3,7 +3,14 @@ $appsecret = '1429a684d8c8407c684c29f404d4c379'; $scope = 'snsapi_userinfo'; $proxy_scope = ''; - $redirect_uri = urlencode('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); + $oldQuaryString = $_SERVER['QUERY_STRING']; + parse_str($oldQuaryString, $quaryStringArr); + $ignoreKey = array('code', 'state', 'access_token', 'openid'); + foreach ($quaryStringArr as $key=>$value) { + if (in_array($key, $ignoreKey)) unset($quaryStringArr[$key]); + } + $newQuaryString = http_build_query($quaryStringArr); + $redirect_uri = urlencode('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?' . $newQuaryString); $code = ''; isset($_GET['code']) && $code = $_GET['code']; $access_token = '';