斜杠在GET请求(用于PHP后端) [英] Slashes in GET request (to be used with PHP back end)
问题描述
%20
并且它实现了诀窍然而,只要我在我的参数值中有斜线,事情不起作用。 例如,我想发送到我的服务器的URL是:
https://randomness.com?path=/var/images/sub%20images/&name=image%2001 .jpg
我怎样才能得到解决方法?
许多字符在网址中被网页主机特别解释, /
字符就是其中之一。
您可以将 /
字符翻译为%2F
,就像翻译
至%20
。
PHP's urlencode功能也可以自动处理这些翻译。
这些编码的参考可以在这里找到,
,你应该手动处理它。
I have to send a GET request to my Apache server. Whenever the parameters have values that are just one words, things work smoothly. Whenever, there are spaces, I am changing them to %20
and it does the trick
However, whenever I have slashes in my parameter values, things do not work. For example, the URL I want to send to my server is:
https://randomness.com?path=/var/images/sub%20images/&name=image%2001.jpg
How can I get a workaround regarding this?
Many characters are specifically interpreted by the web host in URLs and the /
character is one of them.
You can translate your /
characters to %2F
, like you translate to
%20
.
PHP's urlencode function can also handle these translations for you automatically.
A handy reference for these encodings can be found here, should you wish to handle it manually.
这篇关于斜杠在GET请求(用于PHP后端)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!