Php KohanaCurl发送的数据为空
我在以下代码块上使用cURL发送数据: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
$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"));