php://input 返回空字符串 [英] php://input returning empty string

查看:38
本文介绍了php://input 返回空字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码最近开始返回空字符串.它适用于其他系统,因此它似乎不是代码本身的问题.我从字面上删除了所有服务器端代码,它仍然做同样的事情.我也尝试使用 file_get_contents 无济于事,只是在黑暗中拍摄.

The following code recently started returning empty strings. It works on other systems, so it doesn't appear to be a problem with the code itself. I literally eliminated all of the server-side code, and it still did the same thing. I also tried using file_get_contents to no avail, just kind of shooting in the dark.

$fileStream = fopen('php://input', 'rb');

$fileData = '';
while ($buffer = fread($fileStream, 4096)) {
    $fileData .= $buffer;
}

服务器: Zend Server 5.1.0 (Apache 2.2.3)

Server: Zend Server 5.1.0 (Apache 2.2.3)

语言:PHP 5.3.5

前端:Plupload(JavaScript 插件)

Front-End: Plupload (JavaScript plugin)

推荐答案

php://input 无法打开/读取时接收 multipart/form-data POST,也许这就是改变的原因客户端?– Wrikken 3 月 28 日在20:01

php://input cannot be opened/read when receiving a multipart/form-data POST, maybe that's what changed client-sided? – Wrikken Mar 28 at 20:01

感谢您的帮助!

这篇关于php://input 返回空字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆