include "config.php";
include "mysql.php";
$db = new mysql('test'); //几个简单的类,不用列出来大家也看得懂。就是实例化一个数据库连接而已。
function rootmenu ($pid,$n){
global $arr,$db;
$sql = "select * from menu where `pid` =$pid";
$result = $db->query($sql);
while ($i=$db->fetch_array($result)){
$i["title"] =str_repeat('--',$n).$i["title"];
$arr[] =$i;
rootmenu($i["id"],($n+4));
}
return $arr;
}
$arr = RootMenu(0,0);
?>
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号