如何在 symfony 上使用路由注释匹配 URI
how matching URI using Route annotation on symfony
URI 示例: '/department/id/1'
控制器:
/**
@Route/department/id/{slug}
*/
function($slug)
return new Response($slug)
它return我'1'
如果我有 URI:/department/id/1/category/id/2
如何构造捕获1和2的@Route?
请帮忙谢谢
/**
@Route(/department/{slug}/category/{id}, name='department_category_detail')
*/
public function departmentCagetegoryDetailAction($slug, $id) {
....
}
URI 示例: '/department/id/1'
控制器:
/**
@Route/department/id/{slug}
*/
function($slug)
return new Response($slug)
它return我'1'
如果我有 URI:/department/id/1/category/id/2
如何构造捕获1和2的@Route?
请帮忙谢谢
/**
@Route(/department/{slug}/category/{id}, name='department_category_detail')
*/
public function departmentCagetegoryDetailAction($slug, $id) {
....
}