Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php KohanaCurl发送的数据为空_Php_Curl_Kohana_Kohana 3.3 - Fatal编程技术网

Php KohanaCurl发送的数据为空

Php KohanaCurl发送的数据为空,php,curl,kohana,kohana-3.3,Php,Curl,Kohana,Kohana 3.3,我在以下代码块上使用cURL发送数据: $content = $data['email'].'|'.$data['limit'].'|'.$data['docs']; $curl = curl_init(ACCESS_URL); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POST, true); c

我在以下代码块上使用cURL发送数据:

$content = $data['email'].'|'.$data['limit'].'|'.$data['docs'];

$curl = curl_init(ACCESS_URL);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $content);

$answer = curl_exec($curl);
curl_close($curl);
webservice端确实运行并创建了文件,但$\u POST为空。我就是不明白为什么

public function action_getAccess() {
    file_put_contents('/home/donut/uploads/data.txt', $_POST);
}
从curl开始:

curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: text/plain"));
并将其理解为:

file_put_contents('/home/donut/uploads/data.txt', file_get_contents("php://input"));