Constants

API_TOKEN_GET

API_TOKEN_GET = 'https://api.weixin.qq.com/cgi-bin/component/api_component_token'

API.

Properties

$appId

$appId : string

App ID.

Type

string

$secret

$secret : string

App secret.

Type

string

$cacheKey

$cacheKey : string

Cache Key.

Type

string

$queryName

$queryName : string

{@inheritdoc}.

Type

string

$tokenJsonKey

$tokenJsonKey : string

{@inheritdoc}.

Type

string

$prefix

$prefix : string

{@inheritdoc}.

Type

string

Methods

__construct()

__construct(string  $appId, string  $secret, \Doctrine\Common\Cache\Cache  $cache = null) 

Constructor.

Parameters

string $appId
string $secret
\Doctrine\Common\Cache\Cache $cache

getToken()

getToken(boolean  $forceRefresh = false) : string

Get token from WeChat API.

Parameters

boolean $forceRefresh

Returns

string

setToken()

setToken(string  $token, integer  $expires = 7200) : $this

设置自定义 token.

Parameters

string $token
integer $expires

Returns

$this

getAppId()

getAppId() : string

Return the app id.

Returns

string

getSecret()

getSecret() : string

Return the secret.

Returns

string

setQueryName()

setQueryName(string  $queryName) : $this

Set the query name.

Parameters

string $queryName

Returns

$this

getQueryName()

getQueryName() : string

Return the query name.

Returns

string

getQueryFields()

getQueryFields() : array

Return the API request queries.

Returns

array

getTokenFromServer()

getTokenFromServer() : string

{@inheritdoc}.

Returns

string

setHttp()

setHttp(\EasyWeChat\Core\Http  $http) : $this

Set the http instance.

Parameters

\EasyWeChat\Core\Http $http

Returns

$this

setPrefix()

setPrefix(string  $prefix) : $this

Set the access token prefix.

Parameters

string $prefix

Returns

$this

setCacheKey()

setCacheKey(string  $cacheKey) : $this

Set access token cache key.

Parameters

string $cacheKey

Returns

$this

getCacheKey()

getCacheKey() : string

Get access token cache key.

Returns

string —

$this->cacheKey

setVerifyTicket()

setVerifyTicket(\EasyWeChat\OpenPlatform\EasyWeChat\OpenPlatform\VerifyTicket  $verifyTicket) : $this

Set VerifyTicket.

Parameters

\EasyWeChat\OpenPlatform\EasyWeChat\OpenPlatform\VerifyTicket $verifyTicket

Returns

$this