Url 在 URL 中编码一个点 (.)? [英] Url encode a dot (.) in URL?

查看:49
本文介绍了Url 在 URL 中编码一个点 (.)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在 symfony 中做一个小代码,这将导致 url 有这样的资源:

<前>http://url/val/abc.abxhd

我能够从 http://url/val/abc 成功获取参数 abc,但是当我尝试运行 http://url/val/的 URL 时abc.abxhd.Symfony 只是抛出一个 404 错误.

这里可能有什么问题.URl 也是使用 rawurlencode 编写的.

组:网址:/组/:组参数:{模块:组,动作:显示}要求:sf_method: [获取]

解决方案

实际上 symfony 正在寻找点 (.) 作为段分隔符.这就是为什么在我的情况下它找不到路线的原因.在将 ff 添加到我的路线之后.它就像预期的那样工作:

组:网址:/组/:组参数:{模块:组,动作:显示}要求:sf_method: [获取]选项:段分隔符:[/]

Currently I am doing a small code in symfony that will cause url have resource like this:

http://url/val/abc.abxhd

I was able to get the parameter abc successfully from http://url/val/abc, but when I try to run the URL of http://url/val/abc.abxhd. Symfony simply throw a 404 error.

What could be the problem here. the URl are written using rawurlencode also.

group:
  url: /group/:group
  param: {module: group, action: show}
  requirements:
    sf_method: [get]

解决方案

Actually symfony was finding dot (.) as a segment separator. This is the reason why in my case it cannot find the route. After Add the ff to my route. it works just like expected:

group:
  url: /group/:group
  param: {module: group, action: show}
  requirements:
    sf_method: [get]
  options:
    segment_separators: [/]

这篇关于Url 在 URL 中编码一个点 (.)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆