我想知道如何通過標識符獲取層次結構。多維數組層次結構
這是一個例子:
$inputArray = array(
array(
"text" => "Dir1",
"parent_id" => "",
"id" => "1",
"filesize" => "109"
),array(
"text" => "dir2",
"parent_id" => "",
"id" => "2",
"filesize" => "88",
"children" => array(
"text" => "Dir3",
"parent_id" => "2",
"id" => "3",
"filesize" => "",
"children" => array(
"text" => "dir4",
"parent_id" => "3",
"id" => "4",
"filesize" => "",
"children" => array(
"text" => "dir5",
"parent_id" => "4",
"id" => "4",
"filesize" => ""
)
)
)
));
尋找這個例子:
dir3/dir4/dir5
你想在'children'數組上使用這樣的輸出嗎? – splash58
yes yes –
get_tree(5); //我得到dir3/dir4/dir5 –