我有 Symfony 路由问题。即使我在两个不同路由的路径中使用了不同的参数,Symfony 也将其识别为一个模式并指向路由文件中首先定义的路径。例如:
app_restaurants_inner:
path: /london-restaurants/{id}/{restaurant_name}.html
defaults: { _controller: AppBundle:Restaurants:inner}
app_restaurants_by_cuisine:
path: /london-restaurants/cuisine/{cuisine}.html
defaults: { _controller: AppBundle:Restaurants:index}
第一个路由加载一个特定的餐厅,参数是 id 和餐厅名称。餐厅名称仅包含 az、0-9 和连字符。在第二个参数中,只有一个参数是美食。但是,当我尝试加载美食(第二条路线)时,它会将我引导至与美食路径相似的餐厅路径。
另一方面,以下路线也被标识为类似于餐厅的路径。
app_restaurants_by_cuisine_letter:
path: /london-restaurants/cuisine/{cuisine}-{letter}.html
defaults: { _controller: AppBundle:Restaurants:index}
单词“cuisine”标识为“{id}”,“{cuisine}-{letter}”标识为“{restaurant_name}”。
我怎样才能解决这个问题?
ibeautiful