使用分号进行元刷新 [英] Meta refresh with semicolon

查看:99
本文介绍了使用分号进行元刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在URL中使用分号作为查询字符串分隔符,而不是和(&).
我的问题是,当我尝试对查询字符串中的分号进行元刷新时,会将其转换为%253b.因此,转发时,由于分隔符已不存在,我无法读取查询字符串参数.示例:

I have semicolon as query string separator in my urls instead of and (&).
My problem is that when I try to do a meta refresh to a url with semicolon in query string it will translate it to %253b instead. So when forwarded, I can't read the query string parameters as the separator is not there anymore. example:

http://domain.com/?foo=1;bar=2  

成为:

http://domain.com?foo=1%253bbar=2  

我该如何解决这个问题,以便在执行元刷新时不会翻译分号?

How can I solve this, so it doesn't translate the semicolon when doing a meta refresh?

感谢您的帮助!

推荐答案

UPDATE

如注释中所述,;是url的有效字符,该URL保留用于 RFC .就像danorton在自己的答案中指出的那样,问题似乎出在URL的双重编码上.

UPDATE

As pointed in the comments, ; is a valid character for an url which is reserved for a purpose not specified in the RFC. Like pointed by danorton in its own answer, the problem seems to be a double encoding of the URL.

实际上,如果没有更多有关环境和问题发生时的确切情况的信息,就不可能提供解决方案.

As it is, it is impossible to provide a solution without more information about the environment and the exact situation when the problem occurs.

但是,就像我之前的错误答案中所述,我仍然坚持使用&作为分隔符的立场.在我看来,使用其他东西会带来问题.

However, like stated in my previous wrong answer, I stay on my position concerning the use of & as a separator. Using something else is asking for problems in my opinion.

我不认为;是url的有效字符,因此对我来说,对其进行编码似乎很正常.有一个原因&使用了,为什么要更改它?

I don't think ; is a valid character for an url, so it seems normal to me that it get encoded. There's a reason & is used, why do you want to change that ?

做这样的事情会带来问题.要使所有浏览器和OS组合都能正常运行,已经很难了,为什么要使工作变得更困难?

Doing something like this is asking for problems. It's already pretty hard to get things working on all the browsers and OSes combination, why makes things even harder ?

如果您要坚持使用PHP,请使用 urlencode() parse-url()

If you want to stick with this and you're using PHP, have a look at urlencode() and parse-url()

这篇关于使用分号进行元刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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