设为首页 加入收藏

TOP

PHP全路径无限分类导航LINK代码实现
2019-08-15 23:32:23 】 浏览:22
Tags:PHP 路径 无限 分类 导航 LINK 代码 实现
<?php

/**
 * @param php全路径无限分类
 */

include('db.inc.php');
function getPathCate($cateid){
    $sql = "select * ,concat(path,',',id) fullpath from likecate where id = $cateid";
    $res = mysql_query($sql);
    $row = mysql_fetch_assoc($res);
    $ids = $row['fullpath'];
    $sql = "select * from likecate where id in ($ids) orders by id asc";
    $res = mysql_query($sql);
    $result = array();
    while ($row = mysql_fetch_assoc($res)) {
        $result[] = $row;
    }
    return $result;
}

function displayPath($cateid,$link='cate.php?cid='){
    $res = getPathCate($cateid);
    $str = '';
    foreach ($res as $key => $value) {
        $str .= "<a href ='{$link}{$value['id']}'>{$value['catename']}</a>";
    }

}

echo displayPath(4,'cate.php?p=1&cid=');

 

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇全路径无限分类下拉列表的实现 下一篇laravel入门-01

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目