jwt的使用
composer require firebase/php-jwt
$key = “example_key”;
$payload = array(
“iss” => “http://example.org",
“aud” => “http://example.com",
“iat” => 1356999524,
“nbf” => 1357000000
);
/**
- IMPORTANT:
- You must specify supported algorithms for your application. See
- tools.ietf.org/html/draft-ietf-jos...
- for a list of spec-compliant algorithms.
- /
$jwt = JWT::encode($payload, $key, ‘HS256’);
$decoded = JWT::decode($jwt, new Key($key, ‘HS256’));
推荐文章: