如何允许“?” symfony3中的路由参数中的字符 [英] How to Allow a "?" Character in a Route Parameter in symfony3
本文介绍了如何允许“?” symfony3中的路由参数中的字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的用户在我的项目中使用symfony3,并在类似下面的项目中使用路由
i user symfony3 in my project and use a routing in project similar bellow
user_anoref:
path: /noref/{url}
defaults: { _controller: UserBundle:Default:noref }
requirements:
url: ".+"
methods: [GET]
但是在url中使用时?字符路由错误。
but when use in url ? character routing is error .
我在路由中使用了该
http://qnf.ir/noref/?http://eshoptech.ir
请帮助我
推荐答案
更改正则表达式以匹配http url字符串,这未经测试!
Change your regex to match http url strings, this is untested!
user_anoref:
path: /noref/{url}
defaults: { _controller: UserBundle:Default:noref }
requirements:
url: "(http[s]?:\/\/)?([^\/\s]+\/)(.*)"
methods: [GET]
这篇关于如何允许“?” symfony3中的路由参数中的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文