我正在使用苗条的框架来编写自己的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#@" ]
]));
您缺少反斜杠
new Tuupola\Middleware\HttpBasicAuthentication
=>
new \Tuupola\Middleware\HttpBasicAuthentication