From 13c6ceb3ca829ea0b622ed02e632f9be98fa111a Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 9 Sep 2022 12:02:45 +0800 Subject: [PATCH] =?UTF-8?q?code=E5=85=91=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Wechat.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controller/Wechat.php b/app/controller/Wechat.php index 3ae8a2b..633daae 100644 --- a/app/controller/Wechat.php +++ b/app/controller/Wechat.php @@ -41,10 +41,11 @@ class Wechat * @Date : 2022/9/9 11:29 * @Author : */ - public function callback() + public function code() { + $code = $GLOBALS['data']['data']['code']; $this->initWechat(); - $user = $this->app->oauth->user(); + $user = $this->app->oauth->userFromCode($code); // $user 可以用的方法: // $user->getId(); // 对应微信的 OPENID // $user->getNickname(); // 对应微信的 nickname