\WeMiniUser

微信开放平台帐号管理 Class Template

Summary

Methods
Properties
Constants
__construct()
getAccessToken()
delAccessToken()
callPostApi()
callGetApi()
create()
bind()
unbind()
get()
$config
$access_token
No constants found
httpGetForJson()
httpPostForJson()
registerApi()
No protected properties found
N/A
No private methods found
$currentMethod
$isTry
$GetAccessTokenCallback
N/A

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

create()

create(string  $appid) : array

1. 创建开放平台帐号并绑定公众号/小程序

Parameters

string $appid

授权公众号或小程序的 appid

Throws

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

Returns

array

bind()

bind(string  $appid, string  $openAppid) : array

2. 将公众号/小程序绑定到开放平台帐号下

Parameters

string $appid

授权公众号或小程序的appid

string $openAppid

开放平台帐号appid

Throws

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

Returns

array

unbind()

unbind(string  $appid, string  $openAppid) : array

3. 将公众号/小程序从开放平台帐号下解绑

Parameters

string $appid

授权公众号或小程序的appid

string $openAppid

开放平台帐号appid

Throws

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

Returns

array

get()

get(string  $appid) : array

3. 获取公众号/小程序所绑定的开放平台帐号

Parameters

string $appid

授权公众号或小程序的appid

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