PHP code example of shencongcong / jwt

1. Go to this page and download the library: Download shencongcong/jwt library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shencongcong / jwt example snippets


use Shencongcong\Jwt\Jwt

$jwt = \Shencongcong\Jwt\Jwt::getInstance('123');

$playLoad = ['user'=>'xxx','exp'=>1564726174];

// 生成token
$token = $jwt->getToken($playLoad);

// 获取负载
$getPlayLoad = $jwt->verifyToken($token);