php接收纯json数据

我用curl/post方式发送一段数据给一个接口文件发现$_POST输出为Array(),没有获取到任意字符串,百度上找到方法

1 function getRawData(){
2   $put = array();
3   parse_str(file_get_contents('php://input'), $put);
4   return $put;
5 }
原文地址:https://www.cnblogs.com/lixingbaophp/p/4688311.html