<meta charset="utf-8">
在包含表单的网页头部,填写一些值并提交表单后,请求头不会显式地包含有关如何编码POST数据的信息。
POST /experiments/foo.php HTTP/1.1
Host: localhost
Connection: keep-alive
Content-Length: 57
Pragma: no-cache
Cache-Control: no-cache
Origin: http://localhost
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Referer: http://localhost/experiments/how_does_php_encode_data_it_receives_from_browser.php
Accept-Encoding: gzip, deflate
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
还是有其他问题存在吗?例如,浏览器是否需要将字符编码为某个预先确定的标准?
PHP如何知道如何解码从浏览器POST请求接收到的数据?
Content-Type: application/x-www-form-urlencoded
请参考:https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4 - Sammitchapache
处理请求,并在需要时调用PHP解释器。然后浏览器告诉Web服务器它如何编码数据,循环继续进行... - Xorifelse