PHP code example of tinywan / think-jwt
1. Go to this page and download the library: Download tinywan/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/ */
tinywan / think-jwt example snippets regexp
composer
$user = [
'uid' => 2022,
'name' => 'Tinywan',
'email' => '[email protected] '
];
$token = \tinywan\JWT::generateToken($user);
var_dump(json_encode($token));
$uid = \tinywan\JWT::getCurrentId();
$email = \tinywan\JWT::getExtend();
$email = \tinywan\JWT::getExtendVal('email');
$refreshToken = \tinywan\JWT::refreshToken();
$exp = \tinywan\JWT::getTokenExp();
'is_single_device' => true,
$user = \tinywan\JWT::getUser();
'user_model' => function($uid) {
// 返回一个数组
return \think\facade\Db::table('resty_user')
->field('id,username,create_time')
->where('id',$uid)
->find();
}
ssh-keygen -t rsa -b 4096 -E SHA512 -m PEM -P "" -f RS512.key
openssl rsa -in RS512.key -pubout -outform PEM -out RS512.key.pub
ssh-keygen -t rsa -b 4096 -E SHA354 -m PEM -P "" -f RS384.key
openssl rsa -in RS384.key -pubout -outform PEM -out RS384.key.pub
ssh-keygen -t rsa -b 4096 -E SHA256 -m PEM -P "" -f RS256.key
openssl rsa -in RS256.key -pubout -outform PEM -out RS256.key.pub