如何允许“?” symfony3中路由参数中的字符

时间:2016-09-22 13:17:28

标签: routing symfony

我在我的项目中使用symfony3并在项目类似下面使用路由

user_anoref:
path:     /noref/{url}
defaults: { _controller: UserBundle:Default:noref }
requirements:
    url: ".+"
methods: [GET]

但在url中使用时?字符路由错误。

我在路由

中使用了此网址
http://qnf.ir/noref/?http://eshoptech.ir

请帮帮我

1 个答案:

答案 0 :(得分:0)

更改你的正则表达式以匹配http url字符串,这是未经测试的!

user_anoref:
    path:     /noref/{url}
    defaults: { _controller: UserBundle:Default:noref }
    requirements:
        url: "(http[s]?:\/\/)?([^\/\s]+\/)(.*)"
    methods: [GET]
相关问题