【发布时间】:2014-12-23 16:46:11
【问题描述】:
我正在使用 AngularJS 向运行 PHP 5.4 的 Azure IIS 发布一个复杂的 JSON 对象:
var request = $http({
method: "post",
url: "/php/mail.php",
data: $scope.contactForm,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
});
我的 PHP 脚本由这两行组成:
$data = json_decode(file_get_contents("php://input"));
print_r($data);
在尝试读取 POST 数据时,所有数组($_POST、$_REQUEST 和 php://input)都是空的。
没有重定向会杀死POST 数据并回显$_SERVER['CONTENT_TYPE'] 返回'application/x-www-form-urlencoded'。
【问题讨论】:
-
它是否可以在 Azure 之外的服务器上运行?
标签: php json angularjs post azure