PHP是否可以在$ _POST上自动执行urldecode()? [英] Does PHP automatically do urldecode() on $_POST?
问题描述
根据 http://php.net/manual/en/function.urldecode. php ,PHP在$_GET
和$_REQUEST
(包含$_POST
)上执行urldecode()
.
According to http://php.net/manual/en/function.urldecode.php, PHP does urldecode()
on $_GET
and on $_REQUEST
(which contains $_POST
).
但是直接调用$_POST
已经解码了吗?
But is directly calling $_POST
already decoded?
推荐答案
是的,您通过$_GET
和$_POST
访问的所有参数都将被解码.
Yes, all the parameters you access via $_GET
and $_POST
are decoded.
urldecode()
文档未提及$_POST
的原因是因为POST数据最初可能未经过URL编码.这取决于POST数据是以application/x-www-form-urlencoded
格式还是multipart/form-data
格式提交.
The reason the urldecode()
documentation doesn't mention $_POST
is because the POST data might not be URL-encoded in the first place. It depends on whether the POST data is submitted in application/x-www-form-urlencoded
format or multipart/form-data
format.
但是所有这些对于应用程序都是透明的.
But all this is transparent to the application.
$_GET
的文档确实明确提到了这一点,
The documentation of $_GET
does mention this explicitly, though.
注意:
GET变量通过urldecode()
传递.
Note:
The GET variables are passed throughurldecode()
.
这篇关于PHP是否可以在$ _POST上自动执行urldecode()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!