日期:2014-05-16 浏览次数:20544 次
function tree($pid=0) {
$res = array();
$rs = mysql_query("select * from tbl_name where pid=$pid");
while($row = mysql_fetch_assoc($rs)) {
$res[$row['name']] = ($t = tree($row['id'])) ? $t : $row['name'];
}
return $res;
}