使用composer安装 JWT 功能组件
# 安装
composer require lcobucci/jwt 3.3
GitHub - tymondesigns/jwt-auth: 🔐 JSON Web Token Authentication for Laravel & Lumen
封装JWT工具类 (参考 GitHub - lcobucci/jwt at 3.3)
extend/tools/jwt/Token.php
/**
* Created by PhpStorm.
* Author: Shadow
* Date: 2021/12/19
* Time: 5:35 下午
* description: Token.php
*/
namespace app\adminapi\extend\tools\jwt;
use Lcobucci\JWT\Signer\Hmac\Sha256;
use Lcobucci\JWT\Builder;
use Lcobucci\JWT\Parser;
use Lcobucci\JWT\ValidationData;
class Token
{
private static $_config = [
'audience' => 'http://www.pyg.com',//接收人
'id' => '3f2g57a92aa'