您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php无限分级类

2025/9/29 10:08:30发布26次查看
php无限分级类,网站栏目的无分级,以树形结构显示
execute('me',$sql);
$tpc = '';
while($row = $dsql->getarray('me')){
$topc[$row['id']] = $row;
$topid[] = $row['id'];
blc($row['id'],null);
}
function blc($pid,$ppid)
{
global $dsql , $topc;
$rows = '';
$sql = select id,reid,typename from dede_arctype where reid=$pid order by id asc;
$dsql->execute('idme',$sql);
while($row = $dsql->getarray('idme')){
$topc[$pid]['son'][$row['id']] = $row;
$topc[$ppid]['son'][$pid]['son'][$row['id']] = &$topc[$pid]['son'][$row['id']];
$rows[] = $row;
}
if($rows == '')
{
return;
}
else
{
foreach($rows as $varid){
blc($varid['id'],$varid['reid']);
}
return;
}
}
$topkey = array_keys($topc);
$toplength = count($topkey);
foreach($topid as $now_id)
{
for($i=0;$i {
if($topkey[$i] == $now_id) $retop[$topkey[$i]] = $topc[$topkey[$i]];
}
}
unset($topc);
$str = '';
function echotra($row){
global $str;
//if(empty($row['son'])) return;
foreach($row as $id=>$value){
$str .= '
'.$value['typename'].'';
if($value['son']){
$str .='';
echotra($value['son']);
$str .= '';
}
}
}
echotra($retop);
echo $str; ad:真正免费,域名+虚机+企业邮箱=0元
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product