一般我們都會用body 發送post 數據,那么PHP如何接收呢?
<?php
$jsonStr = file_get_contents('php://input');
if (!$jsonStr) {
return $this->jsonCode('參數有誤!', 1);
} else {
$json = json_decode($jsonStr, true);
$jsonData = $json ? $json['studyData'] : '';
if (!$jsonData) {
return $this->jsonCode('參數不能為空!', 1);
}
}
文章來源:劉俊濤的博客 歡迎關注公眾號、留言、評論,一起學習。
__________________________________________________________________________________
若有幫助到您,歡迎點擊推薦,您的支持是對我堅持最好的肯定(*^_^*)
