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

ro

在通过FastCGI将我们的网站之一从具有Apache的Linux迁移到具有运行PHP 5.6的IIS(8.5)的Windows之后,我们遇到了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: '?',
            data: 'Working',
            type: 'PUT'
        }).then(function(response) {
            $('#put').html(response || 'Not working');
        });
    </script>
</body>
</html>

结果是:

邮政:

在职的

放:

无法运作

是什么原因造成的?

ro

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

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

file_get_contents('php:// input'); 返回带有大文件的空字符串

来自分类Dev

PHP:file_get_contents('php:// input')返回JSON消息的字符串

来自分类Dev

解释file_get_contents('php:// input')

来自分类Dev

file_get_contents('php:// input'); 带有application / x-www-form-urlencoded;

来自分类Dev

通过网址参数发送时,file_get_contents('php:// input')返回空

来自分类Dev

通过网址参数发送时,file_get_contents('php:// input')返回空

来自分类Dev

file_get_contents返回PHP代码

来自分类Dev

PHP脚本返回“ file_get_contents”

来自分类Dev

如何“刷新”file_get_contents('php://input') 的状态?

来自分类Dev

PHP file_get_contents 返回 bool(false)

来自分类Dev

php file_get_contents阿拉伯字符

来自分类Dev

PHP file_get_contents输出令人讨厌的字符?

来自分类Dev

file_get_contents()没有响应-php

来自分类Dev

更改 file_get_contents php 中的所有链接

来自分类Dev

file_get_contents 返回空字符串

来自分类Dev

file_get_contents('index.php')的file_put_contents将编写PHP代码

来自分类Dev

什么是python等同于php file_get_contents(“ php:// input”)

来自分类Dev

什么是python等同于php file_get_contents(“ php:// input”)

来自分类Dev

来自csv的PHP file_get_contents()和file_put_contents

来自分类Dev

使用PHP同步file_get_contents和file_put_contents函数

来自分类Dev

php file_get_contents()返回带有有效URL的false

来自分类Dev

无法使用file_get_contents('php:// input')检索原始帖子数据

来自分类Dev

在 Java 中以字符串形式获取网页内容(类似于 php 的 file_get_contents())

来自分类Dev

在PHP中使用file_get_contents进行PUT请求的错误请求

来自分类Dev

在PHP中使用file_get_contents进行PUT请求的错误请求

来自分类Dev

PHP:带有json_decode的file_get_contents不能一起使用

来自分类Dev

带有FILTER_SANITIZE_STRING的PHP filter_input_array允许空字符串

来自分类Dev

nodejs-获取类似于php的file_get_contents的请求正文

来自分类Dev

PHP:file_get_contents()HTTP / 1.0 400 Google Maps API的错误请求

Related 相关文章

  1. 1

    file_get_contents('php:// input'); 返回带有大文件的空字符串

  2. 2

    PHP:file_get_contents('php:// input')返回JSON消息的字符串

  3. 3

    解释file_get_contents('php:// input')

  4. 4

    file_get_contents('php:// input'); 带有application / x-www-form-urlencoded;

  5. 5

    通过网址参数发送时,file_get_contents('php:// input')返回空

  6. 6

    通过网址参数发送时,file_get_contents('php:// input')返回空

  7. 7

    file_get_contents返回PHP代码

  8. 8

    PHP脚本返回“ file_get_contents”

  9. 9

    如何“刷新”file_get_contents('php://input') 的状态?

  10. 10

    PHP file_get_contents 返回 bool(false)

  11. 11

    php file_get_contents阿拉伯字符

  12. 12

    PHP file_get_contents输出令人讨厌的字符?

  13. 13

    file_get_contents()没有响应-php

  14. 14

    更改 file_get_contents php 中的所有链接

  15. 15

    file_get_contents 返回空字符串

  16. 16

    file_get_contents('index.php')的file_put_contents将编写PHP代码

  17. 17

    什么是python等同于php file_get_contents(“ php:// input”)

  18. 18

    什么是python等同于php file_get_contents(“ php:// input”)

  19. 19

    来自csv的PHP file_get_contents()和file_put_contents

  20. 20

    使用PHP同步file_get_contents和file_put_contents函数

  21. 21

    php file_get_contents()返回带有有效URL的false

  22. 22

    无法使用file_get_contents('php:// input')检索原始帖子数据

  23. 23

    在 Java 中以字符串形式获取网页内容(类似于 php 的 file_get_contents())

  24. 24

    在PHP中使用file_get_contents进行PUT请求的错误请求

  25. 25

    在PHP中使用file_get_contents进行PUT请求的错误请求

  26. 26

    PHP:带有json_decode的file_get_contents不能一起使用

  27. 27

    带有FILTER_SANITIZE_STRING的PHP filter_input_array允许空字符串

  28. 28

    nodejs-获取类似于php的file_get_contents的请求正文

  29. 29

    PHP:file_get_contents()HTTP / 1.0 400 Google Maps API的错误请求

热门标签

归档