mirror of
https://github.com/w7corp/easywechat.git
synced 2025-02-02 02:34:22 +00:00
Updated 网页授权 (markdown)
parent
afa9f7b80e
commit
82ab86ad5c
15
网页授权.md
15
网页授权.md
@ -23,4 +23,19 @@
|
||||
$wechat->auth->user();
|
||||
```
|
||||
|
||||
## 示例:
|
||||
|
||||
```php
|
||||
// 如果已经授权
|
||||
if ($wechat->auth->authorized()) {
|
||||
$user = $wechat->auth->user();// 获取已经登录后用户信息
|
||||
Session::set('logged_open_id', $user['open_id']);
|
||||
|
||||
return Redirect::to(你的授权后的页面);
|
||||
} else {
|
||||
$to = 微信授权完成后跳回你的地址,就是当前代码所在的 URL;
|
||||
$wechat->auth->redirect($to, $state = 'STATE', $scope = 'snsapi_base');
|
||||
}
|
||||
```
|
||||
|
||||
更多关于微信网页授权 API 请参考: http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html
|
Loading…
Reference in New Issue
Block a user