全路径无限分类下拉列表的实现
2018-09-19 17:44
387 查看
最终效果图:
代码详情:
include('db.inc.php'); function likecate($path=''){ sql = "select id,catename,path,concat(path,',',id) as fullpath from likecate order by fullpath asc"; $res = mysql_query($sql); $result = array(); while($row = mysql_fetch_assoc($res)){ $deep = count(explode(',',trim($row['fullpath'],','))); //取数组的深度,去除逗号 $row['catename'] = str_repeat(' ',$deep).'|--'.$row['catename']; $result[] = $row; } return $result; } $res = likecate(); echo "<select name= cate>"; foreach ($res as $key => $value) { echo "<option> {$value['catename']}</option>"; } echo "</select>"; print_r($res);
相关文章推荐
- php递归实现无限分类生成下拉列表的函数
- php递归实现无限分类生成下拉列表的函数
- php递归实现无限分类生成下拉列表
- php分类目录下拉列表(递归+无限分类)
- PHP 无限极分类下拉列表实现
- php简单实现无限分类树形列表的方法
- Ajax实现列表无限加载和二级下拉选项效果
- Javascript 生成无限下拉列表实现代码
- Javascript 生成无限下拉列表实现代码
- JS框架[V 1.6.4](包含无限级下拉列表,轻松实现省市县下拉列表)
- 无限级联动下拉框地区分类选择的实现--超傻瓜,超弱智式
- 实现三级联动下拉框 下拉列表… 分类: Android开发 2014-05-30 10:57 67人阅读 评论(0) 收藏
- 递归实现无限分类列表的读取(子类加空格缩进)
- 无限分类下拉列表代码
- PHP全路径无限分类导航LINK代码实现
- 用Ajax实现多级联动下拉列表For JSP(无限级别,JSON传输数据,含全国地区数据库
- php 递归 实现无限分类 格式化数组
- php实现无限级分类
- Android中Spinner下拉列表(使用ArrayAdapter和自定义Adapter实现)
- 仿淘宝首页分类列表效果实现代码