【发布时间】:2021-09-03 04:52:41
【问题描述】:
感谢您阅读我的问题,
我正在尝试向 slim 框架添加中间件,但遇到错误
未捕获的 InvalidArgumentException:所有 Route 中间件都必须是可调用的
$authenticateForRole = function ( $user_Id, $tokenKey ) {
try {
// my stuffs
}
} catch (\Throwable $th) {
echo $th->getMessage();
return false;
}
};
$app->map('/averageresponsetime/',$authenticateForRole($UserId, $token), function () use ($app) {
echo json_encode($post1);
})->via('POST');
$app->run();
【问题讨论】:
-
我正在使用 slim 版本 2 @PHPGeek