From e75c243d24680e96088af5768ab0763b875515eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E6=AD=A3=E8=B6=85?= Date: Thu, 15 Oct 2015 10:41:50 +0800 Subject: [PATCH] =?UTF-8?q?Updated=20=E7=BD=91=E9=A1=B5=E6=8E=88=E6=9D=83?= =?UTF-8?q?=20(markdown)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 网页授权.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/网页授权.md b/网页授权.md index 3ead8f6..6c4f930 100644 --- a/网页授权.md +++ b/网页授权.md @@ -106,11 +106,13 @@ $auth->authorize($to = null, $scope = 'snsapi_userinfo', $state = 'STATE') // 请一定要自己存储用户的登录信息,不要每次都授权 if (empty($_SESSION['logged_user'])) { $user = $auth->authorize(); // 返回用户 Bag - $_SESSION['logged_user'] = $user; + $_SESSION['logged_user'] = $user->all(); // 跳转到其它授权才能访问的页面 +} else { + $user = $_SESSION['logged_user']; } -var_dump($_SESSION['logged_user']); +var_dump($user['openid']); ``` 如果你不想用默认的逻辑,你也可以自己使用下面单独的方法来完成授权的操作: