mysql目录树_无限级目录树+记忆节点状态(PHP+mysql)
借鑒 網(wǎng)友 iuhxq 的設計制作而成的目錄樹,在此感謝 iuhxq 的代碼對我大幫助。
特點:
1、無限級節(jié)點。
2、直接產(chǎn)生html代碼,容易修改。
3、目錄清楚,類似于資源管理器,(csdn論壇的,層數(shù)多了就不容易分清楚層次了)。
4、記憶節(jié)點狀態(tài),人性化。
核心代碼如下:
$time1?= gettimeofday();
require_once("conn.php");
function menu($id)
{
global $conn;
$sql?= "select * from `menu` where id1=".$id;
$result?= @mysql_query($sql);
echo mysql_error();
$row?= mysql_num_rows($result);
if($row==0)
{
return;
}//end if
echo "
".$Rs_item["menuname"]."
";?$i??= 1;?while($Rs_item?= @mysql_fetch_array($result))?{??if (strlen($Rs_item["url"])>0)??{???if ($i>=$row)???{????$menutype?= "file1";???}???else???{????$menutype?= "file";???}//end if???$menuname?= "";???$onmouseup?= "";??}??else??{???if ($i>=$row)???{????$menutype?= "menu3";????$listtype?= "list1";????$onmouseup?= "chengstate('".$Rs_item["id"]."')";???}???else???{????$menutype?= "menu1";????$listtype?= "list";????$onmouseup?= "chengstate('".$Rs_item["id"]."')";???}//end if???$menuname?= $Rs_item["menuname"];??}//end if?>
" class="
" onMouseUp="
">
" style="display:none">
">
$i++;?}//end while?echo ""; }//end function menu ?>
總結(jié)
以上是生活随笔為你收集整理的mysql目录树_无限级目录树+记忆节点状态(PHP+mysql)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: lpr利率是什么意思
- 下一篇: 交通银行身份证过期怎么在app上变更