![](/img/trans.png)
[英]PHP not populating $_POST when using x-www-form-urlencoded
[英]php - Handle application/x-www-form-urlencoded POST request using php
我正在尝试使用PHP处理application/x-www-form-urlencoded
POST请求。 客户以以下格式发送请求:
POST /index.php User-Agent: Android/4.0
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip
action=Settings&device_id=2112121&app_version=420
服务器的响应必须如下所示:
{
"action": "Settings",
"data": {
"entries": {
"service_enabled": "true"
}
},
"data_format": "json"
}
对服务器端的index.php
有任何想法吗?
试试这个$_POST = json_decode(file_get_contents("php://input"), true);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.