Umwandeln PHP array in HTML-Liste
Habe ich das array unter dem ich möchte eine Ausgabe in einem bestimmten HTML-Liste format.
Meine PHP-array ist wie folgt:
Array
(
[MAIN] => Master Product
[ID1] => Array
(
[0] => Product 1
)
[ID2] => Array
(
[0] => Product 2
[ID3] => Array
(
[0] => Product 3
)
[ID4] => Array
(
[0] => Product 4
)
)
)
Den HTML-Liste format, das ich Suche, ist wie folgt.
<ul id="treeview">
<li>Master Product
<ul>
<li>Product 1</li>
<li>Product 2
<ul>
<li>Product 3</li>
<li>Product 4</li>
</ul>
</li>
</ul>
</li>
</ul>
Jede mögliche Hilfe würde geschätzt.
Du musst angemeldet sein, um einen Kommentar abzugeben.
Versuchen Sie, diese für Größe:
//Test #1 -- benannte Werte
echo toUL(array('a'=>'b','c'=>'d','e'=>array('f'=>', g')));
//Folge #1
//Test #2 -- Wert-Listen
echo toUL(array('a','b','c',array('d','e','f')));
//Ergebnis #2
key
- fehlende$