symfony2启用以查找可选参数的路由错误
我想向我的路线添加格式,但此错误总是出现:symfony2启用以查找可选参数的路由错误,symfony,Symfony,我想向我的路线添加格式,但此错误总是出现: 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('ec
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+
/
ecomerce_优先:
路径:/{id}/first.{u format}
默认值:{u控制器:“EcomerceBundle:Default:firstTest”,_格式:html}
要求:_格式:html
id:\d+
在EcomerceBundle的routing.yml中据我所知,您想要这样的url吗 /ecomerce/1/first.html 尝试下一个解决方案:
<li> <a href='{{ path('ecomerce_first',{'id':17, '_format': 'html'})'}}'> First </a> </li>
PS:我注意到这里有额外的{u格式}空格
路径:/{id}/first.{u format}
尝试删除它这是我在base.html.twigeComerce\u first:path://{id}/first中尝试的内容。{u format}默认值:{u controller:{EcomerceBundle:Default:firstTest',u format:html}要求:_格式:EcomerceBundle
/ecomerce/0
的routing.yml中的html id:\d+与路径声明不匹配。细枝片段看起来也不是有效的格式(特别是,{'id':17})-“.html'
不是有效的concat,应该是{'id':17})~'.html'
)欢迎!我很高兴这能帮助你。如果你记下我的答案,我会很高兴的;)