我想在我的路线中添加一种格式,但这个错误总是出现:
No route found for "GET /ecomerce/0" (from "http://localhost/ecomerce/web/app_dev.php/ecomerce/")
404 Not Found - NotFoundHttpException
1 linked Exception: ResourceNotFoundException
这是我尝试过的
//<li> <a href='{{path('ecomerce_first',{'id':17})-'.html'}}'> First </a> </li>
ecomerce_first:
path: /{id}/first.{_format }
defaults: { _controller: "EcomerceBundle:Default:firstTest" , _format: html }
requirements: _format: html
id: \d+
在EcomerceBundle的routing.yml中
答案 0 :(得分:0)
据我所知你想要这样的网址?
/ecomerce/1/first.html
尝试下一个解决方案:
<li> <a href='{{ path('ecomerce_first',{'id':17, '_format': 'html'})'}}'> First </a> </li>
PS:我注意到你在{_format}
中有额外的空格路径:/ {id} / first。{_ format}
尝试删除它