[英]How to get the symbol of plus as it is from $_REQUEST - regular expressions?
How to pass the symbol of plus +
as it is when you want to pass it into $_REQUEST? 如何通过的符号加
+
,因为它是当你想将它传递到$ _REQUEST?
For instance, I want to pass this, 例如,我想通过这个,
xxx.php?key=xPo8lUEXpqg8bKL+32o6yIOK
and I want to get xPo8lUEXpqg8bKL+32o6yIOK
in echo $_REQUEST['key']; 我想在回声$ _REQUEST ['key']中获得
xPo8lUEXpqg8bKL+32o6yIOK
; but I will get this below instead - 但我会在下面得到它-
xPo8lUEXpqg8bKL 32o6yIOK
What should I do to fix this? 我应该怎么做才能解决这个问题? Regular expressions again??
正则表达式又来了??
Thanks. 谢谢。
You need to use %2B
instead of +
, as +
is the URL-encoded symbol for a space. 您需要使用
%2B
而不是+
,因为+
是空格的URL编码符号。 In general, you should use urlencode()
to escape things properly: 通常,您应该使用
urlencode()
正确地进行转义:
$url = "xxx.php?key=" . urlencode('xPo8lUEXpqg8bKL+32o6yIOK');
+
is a reserved character in a URL and decodes to a space. +
是URL中的保留字符,并解码为空格。
Do a urlencode()
on the string before attaching it to the URL. 在将字符串附加到URL之前对字符串执行
urlencode()
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.