composer require firebase/php-jwt:^2.2
安装就OK了
所以
use \Firebase\JWT\JWT;
$key = "example_key";
$payload = array(
"iss" => "http://example.org",
"aud" => "http://example.com",
"iat" => 1356999524,
"nbf" => 1357000000
);
$jwt = JWT::encode($payload, $key);
错误
未找到“Firebase\Jwt\Jwt”类
帮助我!!!
详细错误
谢谢你
index.php 中的代码看起来不像您在此处编写的代码。尝试在index.php中使用
use \Firebase\JWT\JWT;
。
此外,PHP 命名空间区分大小写,因此请确保您编写的正确或使用 IDE 的自动完成功能。
命名空间
Firebase\Authentication;
您可以在此文件路径上使用它来创建此文件路径对象。
src/public/firebase/php-jwt/Authentication/JWT.php