这是我返回的示例数组值 我的示例代码从上面的数组中检索值 我正在使用上述方法从多维数组中检索值。有什么更好的方法可以用来实现自己的目标吗? 答案 0 :(得分:1) 只需: 也许您应该在问题中添加一些上下文。array:3 [▼
"Status" => array:1 [▼
0 => "200"
]
"Data" => array:1 [▼
0 => array:1 [▼
0 => array:2 [▼
"sellerId" => array:1 [▼
0 => "TEST01"
]
"currency" => array:1 [▼
0 => "USD"
]
]
]
]
"Date" => array:1 [▼
0 => "Dec 31 2019"
]
]
foreach($json_array as $key => $json) {
if($key == "Status") {
$status = $json[0];
} else if ($key == "Date") {
$date = $json[0];
} else {
dd($json[0][0]['sellerId'][0]);
}
}
1 个答案:
$status = $json_array['Status'];
$date = $json_array['Date'];