我想循环一个子树菜单,但我无法弄清楚如何做到这一点。
我需要覆盖当前目录路径并放置子。
这是我的预期输出:
../ uploads / username / folder0 / | file1,file2,file3,file4 |
../ uploads / username / | file1,file2,file3,file4,file5,file6,file7 | folder1 / | file1,file2,file3,file4 | folder2 / folder3 / | file1,file2 | folder4 / | file1,file2,file3,file4 |
这是我的代码:
<?php
$list_array = Array(
// Presumed to have been coming from a SQL SELECT, populated for demo.
Array(
'path' => '../uploads/username/folder0/',
'subs' => 'file1, file2, file3, file4'
),
Array(
'path' => '../uploads/username/folder1/folder2/folder3/',
'subs' => 'file1, file2'
),
Array(
'path' => '../uploads/username/folder1/folder2/folder3/folder4/',
'subs' => 'file1, file2, file3'
),
Array(
'path' => '../uploads/username/',
'subs' => 'file1, file2, file3, file4, file5, file6 file7'
),
Array(
'path' => '../uploads/username/folder1/',
'subs' => 'file1, file2, file3, file4'
)
);
$x = 1;
foreach ($list_array as $list_arrays) {
//do something with loop
}
?>