function recursion($multi_dimensional_array)
{
$m = $multi_dimensional_array;
$keys = array();
foreach($m as $key=>$value)
{
$keys[] = $key;
}
$i = 0;
while($i < count($multi_dimensional_array))
{
echo ‘<li><a href=”#”>’.$keys[$i].'</a>’;
if(is_array($multi_dimensional_array[$keys[$i]]))
{
echo ‘<ul>’;
recursion($multi_dimensional_array[$keys[$i]]);
echo ‘</ul>’;
}
echo ‘</li>’;
$i++;
}
}
配合jquery-treeview效果如下: