最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
无限分类php 递归函数
时间:2022-06-24 19:08:59 编辑:袖梨 来源:一聚教程网
| 代码如下 | 复制代码 |
| function createsortoptions ($selected=0,$parent_id=0,$n=-1) { global $db; $sql = "select * from `@__article_sort` where `parent_id` = '{$parent_id}'"; $options = "; static $i = 0; if ($i == 0) { $options .= ' if ($row['sort_id'] == $selected) { $options .=' selected '; } $options .=">".str_repeat(' ',$n*3).$row['sort_name']." "; $options .=createsortoptions ($selected,$row['sort_id'],$n); } } return $options; } |
|
如果是用smarty模板的朋友可以如下调用
| 代码如下 | 复制代码 |
| //– $tpl->assign('sort_list',createsortoptions ()); //– $tpl->assign('sort_list',createsortoptions ($sort_id)); |
|
相关文章
- 如鸢新活动游春集远房亲戚攻略 低配置无核爆通关攻略 08-03
- 燕云十六声免费外观攻略 最难拿到的三个免费套怎么拿 08-03
- 《弧光突袭者》 Arc Raiders “往昔药方”任务攻略 08-03
- 虚无世界宝宝技能搭配攻略(发掘宝宝技能的无限可能) 08-03
- 颠覆认知 曝PS6双机型定价悬殊 多数玩家恐难承受 08-03
- 《盾勇队长技能更换攻略》(优化战斗力,拓展战术选择,走上巅峰之路) 08-03