Properties

$access_token

$access_token : string

访问AccessToken

Type

string

$currentMethod

$currentMethod : array

当前请求方法参数

Type

array

$isTry

$isTry : boolean

当前模式

Type

boolean

$GetAccessTokenCallback

$GetAccessTokenCallback : string

注册代替函数

Type

string

Methods

__construct()

__construct(array  $options) 

BasicWeChat constructor.

Parameters

array $options

getAccessToken()

getAccessToken() : string

获取访问accessToken

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

string

delAccessToken()

delAccessToken() : boolean

清理删除accessToken

Returns

boolean

callPostApi()

callPostApi(string  $url, array  $data, boolean  $isBuildJson = true) : array

接口通用POST请求方法

Parameters

string $url

接口URL

array $data

POST提交接口参数

boolean $isBuildJson

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

callGetApi()

callGetApi(string  $url) : array

接口通用GET请求方法

Parameters

string $url

接口URL

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

apply()

apply(string  $plugin_appid) : array

1.申请使用插件

Parameters

string $plugin_appid

插件appid

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

getList()

getList() : array

2.查询已添加的插件

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

unbind()

unbind(string  $plugin_appid) : array

3.删除已添加的插件

Parameters

string $plugin_appid

插件appid

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

devApplyList()

devApplyList(integer  $page = 1, integer  $num = 10) : array

4.获取当前所有插件使用方(供插件开发者调用)

Parameters

integer $page

拉取第page页的数据

integer $num

表示每页num条记录

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

devAgree()

devAgree(string  $action = 'dev_agree') : array

5.修改插件使用申请的状态(供插件开发者调用)

Parameters

string $action

dev_agree:同意申请;dev_refuse:拒绝申请;dev_delete:删除已拒绝的申请者

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

array

httpGetForJson()

httpGetForJson(string  $url) : array

以GET获取接口数据并转为数组

Parameters

string $url

接口地址

Throws

\WeChat\Exceptions\InvalidResponseException

Returns

array

httpPostForJson()

httpPostForJson(string  $url, array  $data, boolean  $buildToJson = true) : array

以POST获取接口数据并转为数组

Parameters

string $url

接口地址

array $data

请求数据

boolean $buildToJson

Throws

\WeChat\Exceptions\InvalidResponseException

Returns

array

registerApi()

registerApi(string  $url, string  $method, array  $arguments = array()) : mixed

注册当前请求接口

Parameters

string $url

接口地址

string $method

当前接口方法

array $arguments

请求参数

Throws

\WeChat\Exceptions\InvalidResponseException
\WeChat\Exceptions\LocalCacheException

Returns

mixed