Properties

$Version

$Version : string

oauth版本

Type

string

$AppKey

$AppKey : string

申请应用时分配的app_key

Type

string

$AppSecret

$AppSecret : string

申请应用时分配的 app_secret

Type

string

$ResponseType

$ResponseType : string

授权类型 response_type 目前只能为code

Type

string

$GrantType

$GrantType : string

grant_type 目前只能为 authorization_code

Type

string

$Callback

$Callback : string

回调页面URL 可以通过配置文件配置

Type

string

$Authorize

$Authorize : \addons\synclogin\library\sdk\srting

获取request_code的额外参数,可在配置中修改 URL查询字符串格式

Type

\addons\synclogin\library\sdk\srting —

$GetRequestCodeURL

$GetRequestCodeURL : string

获取requestCode的api接口

Type

string

$GetAccessTokenURL

$GetAccessTokenURL : string

获取access_token的api接口

Type

string

$ApiBase

$ApiBase : string

API根路径

Type

string

$Token

$Token : array

授权后获取到的TOKEN信息

Type

array

$display

$display : string

默认第三方授权页面样式

Type

string

$Type

$Type : string

调用接口类型

Type

string

Methods

__construct()

__construct(array  $token = null) : mixed

构造方法,配置应用信息

Parameters

array $token

Returns

mixed —

getInstance()

getInstance(mixed  $type, mixed  $token = null) : mixed

取得Oauth实例

Parameters

mixed $type
mixed $token

Returns

mixed —

返回Oauth

setDisplay()

setDisplay(string  $display) : self

设置授权页面样式

Parameters

string $display

Returns

self —

config()

config() : mixed

初始化配置

Returns

mixed —

getRequestCodeURL()

getRequestCodeURL() : mixed

请求code

Returns

mixed —

getAccessToken()

getAccessToken(string  $code, mixed  $extend = null) : mixed

获取access_token

Parameters

string $code

上一步请求到的code

mixed $extend

Returns

mixed —

call()

call(string  $api, string  $param = '', string  $method = 'GET', mixed  $multi = false) : \addons\synclogin\library\sdk\json

组装接口调用参数 并调用接口

Parameters

string $api

QQ API

string $param

调用API的额外参数

string $method

HTTP请求方法 默认为GET

mixed $multi

Returns

\addons\synclogin\library\sdk\json —

openid()

openid(mixed  $unionid = false) : string

获取当前授权应用的openid

Parameters

mixed $unionid

Returns

string —

getUserInfo()

getUserInfo() : array

获取用户信息

Returns

array —

unionid()

unionid() : string

获取当前授权应用的unionid

Returns

string —

param()

param(array  $params, mixed  $param) : mixed

合并默认参数和额外参数

Parameters

array $params

默认参数

mixed $param

Returns

mixed —

url()

url(string  $api, string  $fix = '') : string

获取指定API请求的URL

Parameters

string $api

API名称

string $fix

api后缀

Returns

string —

请求的完整URL

http()

http(string  $url, array  $params, string  $method = 'GET', mixed  $header = array(), mixed  $multi = false) : array

发送HTTP请求方法,目前只支持CURL发送请求

Parameters

string $url

请求URL

array $params

请求参数

string $method

请求方法GET/POST

mixed $header
mixed $multi

Returns

array —

$data 响应数据

parseToken()

parseToken(string  $result, mixed  $extend) : mixed

解析access_token方法请求后的返回值

Parameters

string $result

获取access_token的方法的返回值

mixed $extend

Returns

mixed —