Crypt
extends BasicWeChat
in
数据加密处理 Class Crypt
Table of Contents
$config | 当前微信配置 | DataArray |
---|---|---|
$access_token | 访问AccessToken | string |
$currentMethod | 当前请求方法参数 | array |
$isTry | 当前模式 | bool |
$cache | 静态缓存 | static |
$GetAccessTokenCallback | 注册代替函数 | string |
decode() | 数据签名校验 | bool |
session() | 登录凭证校验 | array |
userInfo() | 换取用户信息 | array |
getPaidUnionId() | 用户支付完成后,获取该用户的 UnionId | array |
__construct() | BasicWeChat constructor. | mixed |
instance() | 静态创建对象 | static |
getAccessToken() | 获取访问accessToken | string |
setAccessToken() | 设置外部接口 AccessToken | mixed |
delAccessToken() | 清理删除 AccessToken | bool |
httpGetForJson() | 以GET获取接口数据并转为数组 | array |
httpPostForJson() | 以POST获取接口数据并转为数组 | array |
registerApi() | 注册当前请求接口 | mixed |
callPostApi() | 接口通用POST请求方法 | array |
callGetApi() | 接口通用GET请求方法 | array |
Properties
$config
当前微信配置
public
DataArray
$config
$access_token
访问AccessToken
public
string
$access_token
= ''
$currentMethod
当前请求方法参数
protected
array
$currentMethod
= []
$isTry
当前模式
protected
bool
$isTry
= false
$cache
静态缓存
protected
static static
$cache
$GetAccessTokenCallback
注册代替函数
protected
string
$GetAccessTokenCallback
Methods
decode()
数据签名校验
public
decode(
$iv :
string
, $sessionKey :
string
, $encryptedData :
string
)
: bool
Parameters
- $iv : string
- $sessionKey : string
- $encryptedData : string
Return values
boolsession()
登录凭证校验
public
session(
$code :
string
)
: array
Parameters
- $code : string
登录时获取的 code
Tags
Return values
arrayuserInfo()
换取用户信息
public
userInfo(
$code :
string
, $iv :
string
, $encryptedData :
string
)
: array
Parameters
- $code : string
用户登录凭证(有效期五分钟)
- $iv : string
加密算法的初始向量
- $encryptedData : string
加密数据( encryptedData )
Tags
Return values
arraygetPaidUnionId()
用户支付完成后,获取该用户的 UnionId
public
getPaidUnionId(
$openid :
string
[, $transaction_id :
null|string
= null ]
[, $mch_id :
null|string
= null ]
[, $out_trade_no :
null|string
= null ]
)
: array
Parameters
- $openid : string
支付用户唯一标识
- $transaction_id : null|string = null
微信支付订单号
- $mch_id : null|string = null
微信支付分配的商户号,和商户订单号配合使用
- $out_trade_no : null|string = null
微信支付商户订单号,和商户号配合使用
Tags
Return values
array__construct()
BasicWeChat constructor.
public
__construct(
$options :
array
)
: mixed
Parameters
- $options : array
Return values
mixedinstance()
静态创建对象
public
static instance(
$config :
array
)
: static
Parameters
- $config : array
Return values
staticgetAccessToken()
获取访问accessToken
public
getAccessToken(
)
: string
Tags
Return values
stringsetAccessToken()
设置外部接口 AccessToken
public
setAccessToken(
$access_token :
string
)
: mixed
Parameters
- $access_token : string
Tags
Return values
mixeddelAccessToken()
清理删除 AccessToken
public
delAccessToken(
)
: bool
Return values
boolhttpGetForJson()
以GET获取接口数据并转为数组
protected
httpGetForJson(
$url :
string
)
: array
Parameters
- $url : string
接口地址
Tags
Return values
arrayhttpPostForJson()
以POST获取接口数据并转为数组
protected
httpPostForJson(
$url :
string
, $data :
array
[, $buildToJson :
bool
= true ]
)
: array
Parameters
- $url : string
接口地址
- $data : array
请求数据
- $buildToJson : bool = true
Tags
Return values
arrayregisterApi()
注册当前请求接口
protected
registerApi(
&$url :
string
, $method :
string
[, $arguments :
array
= [] ]
)
: mixed
Parameters
- $url : string
接口地址
- $method : string
当前接口方法
- $arguments : array = []
请求参数
Tags
Return values
mixedcallPostApi()
接口通用POST请求方法
public
callPostApi(
$url :
string
, $data :
array
[, $isBuildJson :
bool
= true ]
)
: array
Parameters
- $url : string
接口URL
- $data : array
POST提交接口参数
- $isBuildJson : bool = true
Tags
Return values
arraycallGetApi()
接口通用GET请求方法
public
callGetApi(
$url :
string
)
: array
Parameters
- $url : string
接口URL