通过ajax传入php端数据,通过post方式传入时,取得数据方式为:
$json = file_get_contents("php://input");
可取得所有传入的json文件,但这种文件还是不规则的文件,需要处理,使用
$json = preg_replace("#\\\u([0-9a-f]{4}+)#ie", "iconv(\'UCS-2\', \'UTF-8\', pack(\'H4\', \'\\1\'))", $json);
$json =preg_replace("/([\r\n\t\f])/"," ",$json);
$obj = json_decode($json);
$timeget = $obj->{'timestamp'};
可以调用其文件内的具体数据