您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息

php写的一个递归实现无限分类生成下拉列表的函数

2024/4/19 3:27:10发布4次查看
assign('sort_list',createsortoptions ());//– $tpl->assign('sort_list',createsortoptions ($sort_id));/*—————————————————— */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 .= '请选择';}$res = $db->query ($sql);if ($res){$n++;while ($row = $db->fetch_assoc ($res)){$i++;$options .= sort_id>if ($row['sort_id'] == $selected){$options .=' selected ';}$options .=>.str_repeat(' ',$n*3).$row['sort_name'].\n;$options .=createsortoptions ($selected,$row['sort_id'],$n);}}return $options;} ?>
复制代码
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录