123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- # wechat基本配置
- # 第一步 请求
- $config['auth'] = array
- (
- 'url' => 'https://open.weixin.qq.com/connect/oauth2/authorize',
- 'param' => array
- (
- 'appid' => '',
- 'redirect_uri' => '',
- # 重命名,如果key不是response_type的话
- //'response_type' => array('response_type', 'code'),
- 'response_type' => 'code',
- 'scope' => 'snsapi_userinfo',
- 'state' => '',
- //'contact' => '#wechat_redirect',
- )
- );
- # 第二步 获取token
- $config['token'] = array
- (
- 'url' => 'https://api.weixin.qq.com/sns/oauth2/access_token',
- 'param' => array
- (
- 'appid' => '',
- 'secret' => '',
- 'code' => '',
- 'grant_type' => 'authorization_code',
- ),
- 'response' => array
- (
- 'access_token' => '',
- 'expires_in' => '',
- 'refresh_token' => '',
- 'openid' => '',
- 'unionid' => '',
- 'scope' => '',
- 'errcode' => '',
- 'errmsg' => '',
- )
- );
- # 第三步 获取用户信息
- $config['user'] = array
- (
- 'url' => 'https://api.weixin.qq.com/sns/userinfo',
- 'param' => array
- (
- 'access_token' => 'access_token',
- 'openid' => 'openid',
- 'lang' => 'zh_CN',
- )
- );
- return $config;
|