我需要使用維度數組將我的數據庫結果轉換為一個漂亮的 HTML 表。我知道這是一個非常有條件的情況。我正在使用 CodeIgniter 并且已經有了一些數據。我試圖提取數據庫結果并制作新的數組格式?,F在我對如何將它很好地格式化為 HTML 表格感到困惑。$schedule = [];foreach($this->data['jadwal_kelas'] AS $row){ $schedule['class_name'][$row->class_name]['time'][$row->start.'-'.$row->end] = ['room' => $row->room, 'mentor_code' => $row->mentor_code];}這里的結果使用 print_r<pre>Array( [class_name] => Array ( [E-1] => Array ( [time] => Array ( [07:30:00-08:30:00] => Array ( [room] => A [mentor_code] => TPA-1 ) [08:30:00-09:30:00] => Array ( [room] => A [mentor_code] => TPA-1 ) [10:00:00-11:00:00] => Array ( [room] => A [mentor_code] => FIS-1 ) [11:00:00-12:00:00] => Array ( [room] => A [mentor_code] => FIS-1 ) ) )我不知道如何loop通過數組來創建像上面這樣的表。如果這里有人能指出我正確的方向,將不勝感激。謝謝你。
- 2 回答
- 0 關注
- 206 瀏覽
添加回答
舉報
0/150
提交
取消