'post', 'json' => true, 'url' => 'https://api.weixin.qq.com/cgi-bin/component/api_component_token?', 'param' => array ( 'component_appid' => 'appid', 'component_appsecret' => 'secret', 'component_verify_ticket' => 'ticket', ), //针对一些返回的名称,做转换 'response' => array ( 'component_access_token' => 'token', //'expires_in' => 'expires_in', ), ); # oauth token $config['oauth'] = array ( //第一步,请求code 'code' => array ( 'method' => 'post', 'json' => true, 'url' => 'https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?', 'param' => array ( 'component_access_token' => 'token', 'component_appid' => 'appid', ), 'response' => array ( 'pre_auth_code' => 'oauth.code', ), ), //第二步,拼装redirect,进行授权登录 'login' => array ( 'method' => 'get', 'json' => false, 'url' => 'https://mp.weixin.qq.com/cgi-bin/componentloginpage?', 'param' => array ( 'component_appid' => 'appid', 'pre_auth_code' => 'code', 'redirect_uri' => 'redirect', 'auth_type' => '3', ), ), //第三步,获取到token 'oauth' => array ( 'method' => 'post', 'json' => true, 'url' => 'https://api.weixin.qq.com/cgi-bin/component/api_query_auth?', 'param' => array ( 'component_access_token' => 'token', 'component_appid' => 'appid', 'authorization_code' => 'code', ), 'response' => array ( 'authorization_info.authorizer_appid' => 'openid', 'authorization_info.authorizer_appid' => 'unionid', 'authorization_info.authorizer_access_token' => 'oauth.oauth', 'authorization_info.authorizer_refresh_token' => 'refresh', ), ), ); return $config;