问题
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