【发布时间】:2015-01-11 18:00:12
【问题描述】:
我只是想用 JS 向服务器发送 POST 请求。但是服务器有空的$_POST 数组。我可以使用HTTP_RAW_POST_DATA,但它会在 PHP 5.6 中被弃用。我可以在我的$_POST 数组中发布数据吗?
环境:Chrome、apache2、PHP、AngularJS(我正在使用$http.post函数)。
Debug image(很抱歉没有直接附上图片 - 我没有 10 声望)
【问题讨论】:
-
尝试在 $http.post 中添加标题:{'Content-Type': 'application/x-www-form-urlencoded'}?
-
查看我的Debug image 获取代码。我试过
{'Content-Type': 'application/x-www-form-urlencoded'},但在这种情况下,我在服务器上既没有$_POST,也没有HTTP_RAW_POST_DATA