如何从$

编程入门 行业动态 更新时间:2024-10-09 22:17:15
如何从$ _REQUEST - 正则表达式获得加号的符号?(How to get the symbol of plus as it is from $_REQUEST - regular expressions?)

如何在传递$ _REQUEST时传递plus +符号?

例如,我想通过这个,

xxx.php?key=xPo8lUEXpqg8bKL+32o6yIOK

我想在echo $ _REQUEST ['key']中获得xPo8lUEXpqg8bKL+32o6yIOK ; 但我会在下面得到这个 -

xPo8lUEXpqg8bKL 32o6yIOK

我应该怎么做才能解决这个问题? 正则表达式再次?

谢谢。

How to pass the symbol of plus + as it is when you want to pass it into $_REQUEST?

For instance, I want to pass this,

xxx.php?key=xPo8lUEXpqg8bKL+32o6yIOK

and I want to get xPo8lUEXpqg8bKL+32o6yIOK in echo $_REQUEST['key']; but I will get this below instead -

xPo8lUEXpqg8bKL 32o6yIOK

What should I do to fix this? Regular expressions again??

Thanks.

最满意答案

您需要使用%2B而不是+ ,因为+是空间的URL编码符号。 一般来说,你应该使用urlencode()来正确地转义事物:

$url = "xxx.php?key=" . urlencode('xPo8lUEXpqg8bKL+32o6yIOK');

You need to use %2B instead of +, as + is the URL-encoded symbol for a space. In general, you should use urlencode() to escape things properly:

$url = "xxx.php?key=" . urlencode('xPo8lUEXpqg8bKL+32o6yIOK');

更多推荐

本文发布于:2023-07-09 10:01:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1085506.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!