-1
我有一個php腳本,在我的android應用程序的json中給出響應。在json中添加響應代碼
的JSON:
{"0":"1","id":"1","1":"mahmudul hasan","name":"mahmudul hasan","2":"364","roll":"364","3":"sohel","qrcode":"sohel"}
,但我也想與resonse象下面這樣的狀態:
{
"0": "1",
"1": "mahmudul hasan",
"2": "364",
"3": "sohel",
"id": "1",
"name": "mahmudul hasan",
"roll": "364",
"qrcode": "sohel",
**"success": true**
}
我的JSON響應PHP男女同校:
foreach ($data as $item)
{
if($item!=NULL)
{
echo json_encode($item);
}
else
{
echo json_encode($item);
}
}
應該如何我添加響應狀態?
讓我查一下。這是真的嗎? –
@ sohel14_cse_ju編輯回答 –
我可以返回空JSON沒有數據匹配嗎? –