Home > Backend Development > PHP Tutorial > php递归实现无限分类生成下拉列表的函数_php技巧

php递归实现无限分类生成下拉列表的函数_php技巧

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-17 09:23:49
Original
964 people have browsed it
复制代码 代码如下:

/*—————————————————— */
//– 递归实现无限分类生成下拉列表函数
//– $tpl->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 .= '\n";
$options .=createSortOptions ($selected,$row['sort_id'],$n);
}
}
return $options;
}
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template