Updated 网页授权 (markdown)

安正超 2015-03-19 12:04:03 +08:00
parent afa9f7b80e
commit 82ab86ad5c

@ -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