Php / laravel刀片多维数组
问题描述:
我有下面的数组,我想用laravel刀片作为HTML表格获得它
I have the below arrays and I want to get it in laravel blade as HTML table
$chest = json_decode(Session::get('chest'),TRUE);
array:2 [▼
"chest" => array:2 [▼
"Chest Press" => array:1 [▼
0 => "1"
]
"Flys" => array:2 [▼
0 => "3"
1 => "4"
]
]
"hints" => array:2 [▼
"Chest Press" => array:1 [▼
0 => "test1"
]
"Flys" => array:1 [▼
0 => "test2"
]
]
]
我尝试以下但我没有得到正确的HTML表,它正确的前两列但第三列不是,任何想法如何打印它在HTML桌面上
我尝试过:
I try the below but I dont get right HTML table, its correct the first two columns but the third columnt is not, any ideas how to print it on HTML table
What I have tried:
<table class="table table-striped table-hover table-reflow">
<thead>
<tr>
<th>Exercises</th>
<th>Days</th>
<th>Hints</th>
</tr>
</thead>
<tbody>
@foreach($chests['chest'] as $chest => $exc)
<tr>
<td>{{$chest}}</td>
@foreach($exc as $key => $value)
<td>
{{$value}},
</td>
@endforeach
@endforeach
@foreach($chests['hints'] as $hint => $hin)
@foreach($hin as $key => $value)
<td>
{{$value}}
</td>
@endforeach
</tr>
@endforeach
</tbody>
答
chest = json_decode(Session :: get(' chest'),TRUE);
chest = json_decode(Session::get('chest'),TRUE);
array:2 [▼
"chest" => array:2 [▼
"Chest Press" => array:1 [▼
0 => "1"
]
"Flys" => array:2 [▼
0 => "3"
1 => "4"
]
]
"hints" => array:2 [▼
"Chest Press" => array:1 [▼
0 => "test1"
]
"Flys" => array:1 [▼
0 => "test2"
]
]
]
我尝试以下但我没有得到正确的HTML表,它正确的前两列但第三列不是,任何想法如何打印它在HTML桌面上
我尝试过:
I try the below but I dont get right HTML table, its correct the first two columns but the third columnt is not, any ideas how to print it on HTML table
What I have tried:
<table class="table table-striped table-hover table-reflow">
<thead>
<tr>
<th>Exercises</th>
<th>Days</th>
<th>Hints</th>
</tr>
</thead>
<tbody>
@foreach(
chests ['chest '] as
chests['chest'] as
chest =>
chest =>