Php slimframeworkv3路由条件
在Slim v2中,我们使用这些条件来定义路由Php slimframeworkv3路由条件,php,routes,slim,Php,Routes,Slim,在Slim v2中,我们使用这些条件来定义路由 $app->get('/:route', function($route) use($app) { //Code goes here })->conditions(array('route' => 'route1|route2|route3')); 我的问题是,如何在Slim v3中复制此功能? 谢谢你Slim 3使用的格式是:{name:regular expression conditional} 在您的情况下,您需
$app->get('/:route', function($route) use($app) {
//Code goes here
})->conditions(array('route' => 'route1|route2|route3'));
我的问题是,如何在Slim v3中复制此功能?谢谢你Slim 3使用的格式是:
{name:regular expression conditional}
在您的情况下,您需要:
$app->get('/{route:route1|route2|route3}', function($request, $response, $args) {
$route = $args['route'];
// code here
});