在Slim PHP中,您可以按照以下方式为一条路线创建一组路线和映射:
$app->group('/firstRoute', function () {
$this->map(['GET', 'POST'], '/secondRoute', 'Controller:functionA')->setName('X');
$this->map(['GET', 'POST'], '/thirdRoute', 'Controller:functionB')->setName('Y');
}
但我不知道如何在Silex / Symfony中做同样的事情
是否可以在Silex中创建一种这样的组?
然后如何映射(一条路线中的不同HTTP方法)?
谢谢你们
答案 0 :(得分:1)
您可以通过调用match
函数映射不同的http方法,如下所示:
$app->match('/blog', function () {
// ...
});