<?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=');
如对本文有疑问, 点击进行留言回复!!
[ACTF2020 新生赛]Include 1【文件包含】【读取代码】
算法题解 - 牛客编程巅峰赛S1第6场 - 黄金&钻石&王者组
推荐一个程序员必备网站之一:Dev Hints ,非常实用!
网友评论