PHP接收json格式的POST数据

       

{

  "mobile" : "186xxxxx853",
  "pwd"    :  "123",
   "sign"     : "6493c19c0f099c3c5d4907d139bd5e21",
   "userId"  : "123",
   "typename" : "黄金钱包"
}
$content = file_get_contents('php://input');
$post = json_decode($content, true);

$mobile = $post['mobile'];

注:json_decode  第二个参数,写true就是数组,不写就是对象
当$post是对象的时候取mobile的值
$mobile = $post->mobile;
posted @ 2020-07-21 16:13  大熊童鞋  阅读(3784)  评论(0编辑  收藏  举报