在 URL 中可以使用哪些字符? [英] What characters can one use in a URL?

查看:27
本文介绍了在 URL 中可以使用哪些字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,它采用 url 中的所有参数,如下所示:/category/subcategory/sub-subcategory.我希望能够在 URL 的末尾给出额外的参数,比如 page-2/order-desc.这将使整个 URL 变成 cat/subcat/sub-subcat{delimiting-character}page-2/order-desc.

I have an application that takes all the parameters in the url like this: /category/subcategory/sub-subcategory. I want to be able to give out extra parameters at the end of the URL, like page-2/order-desc. This would make the whole URL into cat/subcat/sub-subcat{delimiting-character}page-2/order-desc.

我的问题是:我可以使用哪些字符作为 {delimiting-character}.我倾向于更喜欢:",因为我知道它永远不会出现在其他任何地方,但我不知道它是否符合标准,或者至少将来不会给我带来问题.

My question is: what characters could I use as {delimiting-character}. I tend to prefer ":" as I know for sure it will never appear anyplace else but I don't know if it would be standard compliant or at least if it will not give me problems in the future.

我记得 vimeo 使用过这样的东西:vimeo.com/video:{code} 但他们似乎已经改变了这一点.

As I recall vimeo used something like this: vimeo.com/video:{code} but they seem to have changed this.

推荐答案

您可以使用字母数字以及特殊字符$-_.+!*'(),"更多信息请访问:http://www.ietf.org/rfc/rfc1738.txt

You can use alphanumeric, plus the special characters "$-_.+!*'()," More info here: http://www.ietf.org/rfc/rfc1738.txt

另外,注意url不要超过2000个字符

Also, take note not to exceed 2000 characters in url

这篇关于在 URL 中可以使用哪些字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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