2017-08-11 42 views
0

例如情況下URI匹配的URI: '/部門/ ID/1'如何使用上symfony的路線標註

控制器:

/** 

    @Route/department/id/{slug} 
*/ 
     function($slug) 
     return new Response($slug) 

還給我 '1'

如果我有URI:/department/id/1/category/id/2

如何形成捕獲1和2的@Route?

請幫助謝謝

+2

我覺得你真的應該閱讀symfony的文件... –

回答

1
/** 
@Route(/department/{slug}/category/{id}, name='department_category_detail') 
*/ 
public function departmentCagetegoryDetailAction($slug, $id) { 
    .... 
}