PHP 中 JavaScript 的 decodeURIcomponent 的等价物是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3896591/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 06:33:17  来源:igfitidea点击:

What is the equivalent of JavaScript's decodeURIcomponent in PHP?

phpjavascriptdecodeencode

提问by neo-nant

I have a string with unicode characters that I am transferring via HTTP. This string was encoded with Javascript's encodeURIcomponent(). Is there an equivalent function in php to Javascript's decodeURIComponent()?

我有一个通过 HTTP 传输的带有 unicode 字符的字符串。这个字符串是用 Javascript 的encodeURIcomponent(). php 中是否有与 Javascript 等效的功能decodeURIComponent()

回答by Explosion Pills

urldecode()

However you do not need to use it on $_REQUEST variables, which are already decoded automatically.

但是,您不需要在 $_REQUEST 变量上使用它,这些变量已经自动解码了。