我有这个多维数组。
[["A1",[["passed",432],["failed",0],["blocked",0],["not_run",0]]],["A2",[["passed",118],["failed",2],["blocked",0],["not_run",0]]],["A3",[["passed",332],["failed",2],["blocked",5],["not_run",0]]],["Learning",[["passed",358],["failed",1],["blocked",0],["not_run",0]]],["A4",[["passed",1923],["failed",7],["blocked",11],["not_run",0]]],["A5",[["passed",93],["failed",0],["blocked",0],["not_run",0]]]]
A1,A2,A3,A4是另一个阵列的关键。
我已经尝试了
{foreach from=$new_data item=item}
<h1>{$item.[0]}</h1>
{/foreach}
但什么也没得到。 我怎样才能访问上面的数组?除了使用foreach循环之外还有其他方法吗?
Expected Result:
Key: A1
Value: [["passed",93],["failed",0],["blocked",0],["not_run",0]]
Similarly for other keys too.
答案 0 :(得分:0)
foreach ($a as $a_new=>$a_array) {
foreach ($a_array as $a_new_a) {
echo $a_new_a;
}
}
@Anubhav你必须学习多维数组它是如何工作的,你需要为每个循环使用两个来访问数据