PHP code example of lgdz / jwt

1. Go to this page and download the library: Download lgdz/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/ */

    

lgdz / jwt example snippets


try {

    $jwt = new Jwt('私钥', '公钥');
    
    //签发token
    $jwt->issue($data, 60);
    
    //验证token
    $jwt->check($token);
    
} catch (\Exception $e) {
    var_dump($e->getMessage());
}