//数据库表
include "comm.php";
//获取分类菜单
$arr=getTree();
$arrone=getFlone(59);
$arrtwo=getFltwo(93);
$arrmenu=getFlmenu(59);
print_r($arrmenu);
//获取分类树
function getTree(){
global $db;
$sql="select flid,flpid,flpath,fltitle,fldes,keyword from fenlei order by flid";
$rs=$db->query($sql);
$data=array();
while ($row=$db->fetch_array($rs)){
$data[]=$row;
}
return $data;
}
//活动一级分类 注意在这顶级分类id为 59
function getFlone($flpid){
global $db;
$sql="select * from fenlei where flpid={$flpid} order by flid";
$rs=$db->query($sql);
$data=array();
while ($row=$db->fetch_array($rs)){
$data[]=$row;
}
return $data;
}
//活动二级分类
function getFltwo($flpid){
global $db;
$sql="select * from fenlei where flpid={$flpid} order by flid";
$rs=$db->query($sql);
$data=array();
while ($row=$db->fetch_array($rs)){
$data[]=$row;
}
return $data;
}
//循环获取菜单,此数据库顶级父分类id为 59
function getFlmenu($flpid){
global $db;
$arr=getFlone($flpid);
foreach ($arr as &$v) {
$arrt=getFlone($v["flid"]);
foreach ($arrt as &$vl){
$arrtt=getFlone($vl["flid"]);
$vl["tt"]=$arrtt;
}
$v["two"]=$arrt;
}
return $arr;
}
?>
Array
(
[0] => Array
(
[0] => 93
[flid] => 93
[1] => 59
[flpid] => 59
[2] => 国内新闻
[fltitle] => 国内新闻
[3] => 0-59
[flpath] => 0-59
[4] => 国内新闻
[fldes] => 国内新闻
[5] => 国内新闻
[keyword] => 国内新闻
[two] => Array
(
[0] => Array
(
[0] => 98
[flid] => 98
[1] => 93
[flpid] => 93
[2] => 时政
[fltitle] => 时政 本文链接http://www.cxybl.com/html/wlbc/Php/20121120/34051.html

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SublimeText3 Linux new version
SublimeText3 Linux latest version

Atom editor mac version download
The most popular open source editor

SublimeText3 Chinese version
Chinese version, very easy to use