【发布时间】:2017-01-04 16:46:49
【问题描述】:
我有以下路线:
product_category:
path: /{grandFatherSlug}/{fatherSlug}/{childSlug}
defaults: { _controller: ProductCategory:productCategoryPage, fatherSlug: "", childSlug: ""}
options:
由于 SEO 建议,我希望这种路线以斜杠结尾。 但我不能让它工作。我试过了:
product_category:
path: /{grandFatherSlug}/{fatherSlug}/{childSlug}/
defaults: { _controller: ProductCategory:productCategoryPage, fatherSlug: "", childSlug: ""}
options:
但是我得到了一个找不到路由的异常并且:
product_category:
path: /{grandFatherSlug}/{fatherSlug}/{childSlug}/
defaults: { _controller: ProductCategory:productCategoryPage, fatherSlug: "", childSlug: ""}
requirements:
childSlug: .+
fatherSlug: .+
grandFatherSlug: .+
但是我得到了带有斜杠的最后一个参数,这让我在控制器中调用 str_replace 来删除它。
是否有任何简单的解决方案来实现这种行为?
谢谢
【问题讨论】:
标签: symfony