问题描述
我正在尝试通过百分比(%)登录网址,例如
I am trying to pass percent (%) sign in url like
%B6011000995504101^SB
但是当我回声时,它会返回
but when I echo, it returns
♦011000995504101^SB
我想要与在URL中传递的值完全相同的值.
I want exact same value as I pass it in URL.
我试图使用urlencode()函数,但是它给了我这样的输出...
I have tried to use urlencode() function, but it give me output like this...
%B6011000995504101%5ESB
请帮助我
推荐答案
答案:
要发送%
登录网址,请发送%25
.
Answer:
To send a %
sign in a url, instead send %25
.
对于您的情况,要使php看到百分号,必须将字符串%25B6011000995504101^SB
传递给服务器.
In your case, in order for php to see a percent sign, you must pass the character string %25B6011000995504101^SB
to the server.
在URL中,百分号具有特殊含义.用于编码特殊字符.例如,&
是参数之间的分隔符,因此,如果您希望参数实际上包含一个&
,则改为编写%26
.因为百分号用于编码特殊字符,所以它也是 特殊字符,因此,如果要实际发送百分号,则还必须对其进行编码.百分号的编码为%25
.
In URLs, the percent sign has special meaning. Is used to encode special characters. For example, &
is the separator between parameters, so if you want your parameter to actually contain an &
, you instead write %26
. Because the percent sign is used to encode special characters, it is also a special character, and so if you want to actually send a percent sign, it must also be encoded. The encoding for a percent sign is %25
.
这篇关于在URL中传递百分号(%),并使用php获得确切的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!