如何在苗条的php中使用基本身份验证?

问题描述 投票:0回答:1

我正在使用苗条的框架来编写自己的API,一切都很好,但是当我添加slim-basic-auth库来保护我的API并对其进行测试时……。我总是会收到此错误:

未捕获的错误:找不到类'Tuupola \ Middleware \ HttpBasicAuthentication'D:\ xampp \ htdocs \ mydatabase \ public \ index.php:22

有什么帮助吗?

我安装了该库并像在教程中一样使用它

$app->add(new Tuupola\Middleware\HttpBasicAuthentication([
        "secure"=>false,
        "users" => [
                "userName@#" => "password#@"        ]
        ]));
php web-services authentication http-authentication slim-3
1个回答
0
投票

您缺少反斜杠

new Tuupola\Middleware\HttpBasicAuthentication

=>

new \Tuupola\Middleware\HttpBasicAuthentication

© www.soinside.com 2019 - 2024. All rights reserved.