PHP是否可以在$ _POST上自动执行urldecode()? [英] Does PHP automatically do urldecode() on $_POST?

查看:148
本文介绍了PHP是否可以在$ _POST上自动执行urldecode()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 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 through urldecode().

这篇关于PHP是否可以在$ _POST上自动执行urldecode()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆