\orgJwt

Jwt 封装

Summary

Methods
Properties
Constants
__construct()
getInstance()
get_token()
checkToken()
gToken()
cToken()
$instance
No constants found
No protected methods found
$issuer
$subject
$audience
$expire
$time
$not_before
$key
$jti
N/A
No private methods found
$sha256
$parser
N/A

Properties

$instance

$instance : 

Type

$issuer

$issuer : 

Type

$subject

$subject : 

Type

$audience

$audience : 

Type

$expire

$expire : 

Type

$time

$time : 

Type

$not_before

$not_before : 

Type

$key

$key : 

Type

$jti

$jti : 

Type

$sha256

$sha256 : 

Type

$parser

$parser : 

Type

Methods

__construct()

__construct(array|string  $option = null) 

Jwt constructor.

Parameters

array|string $option

字符串为秘钥,更多参数请使用数组['expire'=>过期时间,'key'=>秘钥,'audience'=>接收人,'issuer'=>签发者,'subject'=>主题,'time'=>生成token的时间,'not_before'=>秒内token无效]

getInstance()

getInstance(  $option = null) 

Parameters

$option

get_token()

get_token(integer  $id, integer  $expire, array  $data = array()) : string

获取Token Author: websky

Parameters

integer $id

Token的唯一标识

integer $expire

数字为过期时间

array $data

附加数组

Returns

string

checkToken()

checkToken(string  $token = '', string  $key = '', boolean  $isArray = false) : array|boolean|mixed

验证Token Author: websky

Parameters

string $token
string $key
boolean $isArray

Returns

array|boolean|mixed

gToken()

gToken(integer  $id, integer  $exp, array  $data = array()) : string

get_token Author: websky

Parameters

integer $id

token ID

integer $exp

过期时间默认3600秒

array $data

token附加数组

Returns

string

cToken()

cToken(string  $token = '', boolean  $isArray = false) : array|boolean|mixed

验证Token Author: websky

Parameters

string $token
boolean $isArray

Returns

array|boolean|mixed