关于post请求php文件,php文件收到的数据为[][][][][]....模式

header('Content-type: application/json');

$para = file_get_contents('php://input');

在头部加上这两句,就可以把$_POST的数据传入到$para,此时$para的数据格式为json字符串。

可用json_decode($para,true)将数据转化为数组做接下来的处理。

 

$myfile = fopen("2.txt", "w") or die("Unable to open file!");
fwrite($myfile,$para);
fclose($myfile);

用日志记录该数据。

posted on 2017-02-21 09:34  LSMORPJER  阅读(133)  评论(0编辑  收藏  举报

导航