【APP接口开发】php获取body数据

PHP获取接口数据:

$postStr = file_get_contents("php://input");//因为很多都设置了register_globals禁止,不能用$GLOBALS["HTTP_RAW_POST_DATA"];

php采用函数:file_get_contents('php://input'); ,如果 $GLOBALS['HTTP_ROW_POST_DATA'] 没有禁用,也可以使用这个来代替

返回的是json对象,转换成数组:$postArr = json_decode($postStr,TRUE);

原文地址:https://www.cnblogs.com/xuzhengzong/p/8606124.html