file_get_contents(‘php:// input’)返回带有PUT请求的空字符串

在将Apache的一个网站从Apache移植到 Windows(IIS)(8.5)通过FastCGI运行 PHP 5.6之后,我们遇到了file_get_contents(‘php:// input’)为PUT请求返回一个空字符串的问题.

我创建了以下测试:

<?php
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && 
    strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
    die(file_get_contents('php://input'));
}
?>
<!DOCTYPE html>
<html>
<head>
    <script src="//code.jquery.com/jquery-2.1.3.min.js"></script>
</head>
<body>
    <h2>POST:</h2>
    <div id="post"></div>

    <h2>PUT:</h2>
    <div id="put"></div>
    <script>
        $.ajax({
            url: '?',data: 'Working',type: 'POST'
        }).then(function(response) {
            $('#post').html(response || 'Not working');
        });

        $.ajax({
            url: '?',type: 'PUT'
        }).then(function(response) {
            $('#put').html(response || 'Not working');
        });
    </script>
</body>
</html>

其结果如下:

POST:

Working

PUT:

Not working

可能是什么原因造成的?

事实证明,问题是由Helicon Ape模块(支持Apache .htaccess和.htpasswd配置文件的模块)引起的. 删除此模块可解决问题,但我仍然不知道为什么会干扰PUT请求.我想我必须在他们的论坛上发表一个话题,这个问题.

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...