最新下载
热门教程
- 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)); |
|
相关文章
- 斗罗大陆诛邪传说凤仙扇强度如何 12-03
- 铃兰之剑为这和平的世界杰洛特技能组及加点 12-03
- 三国天下归心贾诩控制队玩法攻略 12-03
- 新三国志曹操传诸兵阵演15-6群雄打法 12-03
- 魔灵武士刺客薇洛莱特玩法攻略分享 12-03
- 魔灵武士剑士尼克斯玩法攻略分享 12-03