所以我手动发出POST请求:
标头
User-Agent: Fiddler
Host: myhost.com
Content-Length: 11
Content-Type: multipart/form-data; boundary=xYzZY
Te: deflate,gzip;q=0.3
Connection: close
请求主体:
from=lalala
但是,从站点检查$_POST变量会发现该变量是空的。。。
如果我将其应用程序/x-www-form-urlencoded,尽管
User-Agent: Fiddler
Host: myhost.com
Content-Length: 11
Content-Type: application/x-www-form-urlencoded; boundary=xYzZY
Te: deflate,gzip;q=0.3
Connection: close
$_POST变量将正确填充。。。
为什么在使用多部分/表单数据时没有填充$_POST变量?如何使用多部分/表单数据使其工作?
因为multipart/form-data
的格式完全不同。您在这两种情况下都提供了application/x-www-form-urlencoded
格式。