PHP://输入返回空 [英] php://input returns empty
问题描述
我有骨气的应用。当模型更新PUT请求发送到我的服务器。
I have Backbone application. When model updates PUT request goes to my server.
客户端看起来不错。但是在服务器端(PHP)我有一些麻烦。当我第一次测试中PHPStorm这一要求:
Client-side looks good. But on the server side (PHP) I have some trouble. When I first time test this request in PHPStorm:
file_get_contents('php://input')
返回我的期望。但在其他时候,它总是返回空。我重新启动Apache的 - 没有什么帮助。
return what I expect. But on the other times it always return empty. I restarted Apache - nothing helps.
我知道
请注意:甲流用PHP打开://输入只能读取一次;
Note: A stream opened with php://input can only be read once;
但我鑫卡特意味着一个接请求。每个生命不是一次:)哪里是我的错?
But I thinked that mean one by request. Not once per life :) Where is my mistake?
推荐答案
这是Kohana的问题。在Kohana_Request类有一块code,已经开通的PHP://输入流
It was Kohana problem. In Kohana_Request class there is piece of code, that already opened php://input stream
if ($method !== HTTP_Request::GET)
{
// Ensure the raw body is saved for future use
$body = file_get_contents('php://input');
}
这篇关于PHP://输入返回空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!