我使用file_get_contents('php://input')
,但有时它不会工作。我使用getallheaders()
检查了标题,Content-Length
始终是内容的大小,但有时file_get_contents('php://input')
返回null。
Try This:
$handle = fopen('php://input','r');
$jsonInput = fgets($handle);
$decoded = json_decode($jsonInput,true);
//$decoded['tag'] you data