是否可以在中间件函数中获取请求方法(GET、POST、PUT、...)?
$myMiddleware = function (Request $request) {
// This is what I want to achieve
switch ($request->request->get('method') {
case 'GET':
// ...
break;
}
}
$app = new Application();
$app->before($myMiddleware);