<>strong>php>side,请请在座标上以各种形式检索:
$menu = array(
page/1 => about ,
page/2 => photos ,
menu-title => array( page/4 => sub-menu-1 , page/5 => sub-menu-2 )
);
echo <ul> ;
foreach($menu as $key => $value){
if(is_string($value)){
echo <li><a href=" .$key. "> .$value. </a></li> ;
}
if(is_array($value)){
echo <ul> ;
echo <li><a href="#"> .key($value). </a></li> ;
foreach($value as $sub_key => $sub_value){
echo <li><a href=" .$sub_key . "> .$sub_value. </a></li> ;
}
echo </ul> ;
}
}
echo </ul> ;
for mysql database, have a column of "parent_id" if it is null then it would be a root level, other than that, it would be a sub there, another column of "path" and "title,you can add a "weight" column as well to order them.
<>strong>NOTE:这是未经测试的代码。