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;


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM