1. Go to this page and download the library: Download hedali/think-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/ */
use hedali\JWTAuth\Facade\Jwt;
use hedali\JWTAuth\Exception\HasLoggedException;
use hedali\JWTAuth\Exception\TokenAlreadyEexpired;
class User {
public function test()
{
if (true === Jwt::verify($token)) {
// 验证成功
}
// 验证成功
// 如配置用户模型文件 可获取当前用户信息
dump(Jwt::user());
}
}