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