以下是我的代碼:爲什麼在以下情況下JSON數據沒有轉換爲數組?
$json_body = $application->request->getBody();
/*echo "JSON Body : ".$json_body;
die;
prints following data :
JSON Body :
{ 「current_user_id」:901
"user_id":990
}
*/
$request_data = json_decode($json_body, true); // Parse the JSON data to convert that into an assoc. array
print_r($request_data); die;//This statement prints nothing
我沒有得到爲什麼陣列notgetting執行該語句$request_data = json_decode($json_body, true);
請別人幫我後打印。
'「'不等於'「'性格似乎無效你得到JSON'$應用程序 - >請求 - > getBody() ;' – MrRP
做一個'var_dump($ json_body);'來檢查該變量的類型是否是一個字符串 – pythonian29033