共计 714 个字符,预计需要花费 2 分钟才能阅读完成。
设定咱们发送的数据为:
键 | 值 |
---|---|
username | admin |
password | 123456 |
form-data
用 form-data
发送的数据,申请的 ContentType
是以下内容:
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryC9HBfJBUOivu2WEP
前面的 boundary
就规定了分界线是:----WebKitFormBoundaryC9HBfJBUOivu2WEP
发送的内容格局如下:
------WebKitFormBoundaryC9HBfJBUOivu2WEP
Content-Disposition: form-data; name="username"
admin
------WebKitFormBoundaryC9HBfJBUOivu2WEP
Content-Disposition: form-data; name="password"
123456
------WebKitFormBoundaryC9HBfJBUOivu2WEP--
这个时候 php://input
是拿不到该内容的,$_POST
能够获取。
x-www-form-urlencoded
如果抉择了x-www-form-urlencoded
, 发送的值是:
username=admin&password=123456
php://input
和 $_POST
均能接管到此申请传来的值
php://input
还能够获取 Content-Type
为text/html
形式发送过去的数据。
$GLOBALS['HTTP_RAW_POST_DATA']
这种获取申请内容的形式,曾经过期了,PHP5.6 之后就弃用了。
正文完