mirror of
https://github.com/w7corp/easywechat.git
synced 2025-01-22 19:52:10 +00:00
太久没用php自带的session,导致用这段代码测试的时候,没有开启session,$_SESSION 永远是空的,于是每个请求都走了一次微信验证
parent
231b28767a
commit
1264f1d355
1
网页授权.md
1
网页授权.md
@ -104,6 +104,7 @@ $auth->authorize($to = null, $scope = 'snsapi_userinfo', $state = 'STATE')
|
|||||||
```php
|
```php
|
||||||
|
|
||||||
// 请一定要自己存储用户的登录信息,不要每次都授权
|
// 请一定要自己存储用户的登录信息,不要每次都授权
|
||||||
|
session_start();
|
||||||
if (empty($_SESSION['logged_user'])) {
|
if (empty($_SESSION['logged_user'])) {
|
||||||
$user = $auth->authorize(); // 返回用户 Bag
|
$user = $auth->authorize(); // 返回用户 Bag
|
||||||
$_SESSION['logged_user'] = $user->all();
|
$_SESSION['logged_user'] = $user->all();
|
||||||
|
Loading…
Reference in New Issue
Block a user