Closed ifui closed 1 year ago
支持路由中间件传递参数功能
\Webman\Route::post('/demo', [\app\controller\DemoController::class, 'index']) ->middleware([ [\app\middleware\ThrottlerMiddleware::class, 60, 2], [\app\middleware\AuthMiddleware::class, 'admin'], ]);
<?php namespace app\middleware; use Webman\Http\Request; use Webman\Http\Response; use Webman\MiddlewareInterface; class ThrottlerMiddleware implements MiddlewareInterface { public function process(Request $request, callable $next, ...$args): Response { $limitTime = $args[0]; $limitNum = $args[1]; // ... return $next($request); } }
非常感谢你的pr 已经采用了 #71 的方案
支持路由中间件传递参数功能
路由配置示例:
中间件配置示例: