How to Allow a “?” Character in a Route Parameter in symfony3

无人久伴 提交于 2019-12-23 03:09:42

问题


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]

but when use in url ? character routing is error .

i used this url in routing

http://qnf.ir/noref/?http://eshoptech.ir

please help me


回答1:


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]


来源:https://stackoverflow.com/questions/39640187/how-to-allow-a-character-in-a-route-parameter-in-symfony3

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!