我有來自角度前端的JSON響應。答案是:如何在Laravel中獲取Json數據
{
"selected": null,
"lists": [
{
"board one": [
{
"card_name": "Card 10",
"id": 1,
"card_unique_id": "PC1"
},
{
"card_name": "card 11",
"id": 2,
"card_unique_id": "PC2"
},
{
"card_name": "card12",
"id": 3,
"card_unique_id": "PC3"
},
{
"card_name": "adfaf",
"id": 12,
"card_unique_id": "PC12"
},
{
"card_name": "fa df af ad",
"id": 13,
"card_unique_id": "PC13"
}
],
"BoardId": "PB1"
},
{
"board two": [
{
"card_name": "Card 20",
"id": 4,
"card_unique_id": "PC4"
},
{
"card_name": "CArd 21",
"id": 5,
"card_unique_id": "PC5"
},
{
"card_name": "card 23",
"id": 6,
"card_unique_id": "PC6"
},
{
"card_name": "Card 24",
"id": 7,
"card_unique_id": "PC7"
}
],
"BoardId": "PB2"
},
{
"board three": [
{
"card_name": "Card 30",
"id": 8,
"card_unique_id": "PC8"
},
{
"card_name": "card 31",
"id": 9,
"card_unique_id": "PC9"
},
{
"card_name": "card 32",
"id": 10,
"card_unique_id": "PC10"
}
],
"BoardId": "PB3"
},
{
"new board": [
{
"card_name": "card 40",
"id": 11,
"card_unique_id": "PC11"
}
],
"BoardId": "PB4"
}
]
}
我想在laravel中獲取所有卡的名稱。在laravel控制器函數中,我的代碼如下所示:它返回一些錯誤。我不知道如何獲取所有這些card_names
。
public function sortupdate(Request $response)
{
$get_result_arr = json_decode($response->getContent());
foreach($get_result_arr as $result){
$lists = $result->lists;
}
}
請任何人幫忙。 感謝高級..
請上的錯誤更具體返回 – Wistar
我不知道如何獲取。請回答。謝謝Wistar – SARAN