未找到“Firebase\Jwt\Jwt”类 YII2

问题描述 投票:0回答:2
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”类

帮助我!!!

详细错误

Dettaglio Errore

谢谢你

firebase yii2 jwt
2个回答
1
投票

index.php 中的代码看起来不像您在此处编写的代码。尝试在index.php中使用

use \Firebase\JWT\JWT;
。 此外,PHP 命名空间区分大小写,因此请确保您编写的正确或使用 IDE 的自动完成功能。


0
投票

命名空间

Firebase\Authentication;

您可以在此文件路径上使用它来创建此文件路径对象。

src/public/firebase/php-jwt/Authentication/JWT.php
© www.soinside.com 2019 - 2024. All rights reserved.