If you write a system by yourself, you will often use column management
If there are many levels of column classification, you need to implement infinite classification. The code is as follows
1. Usage in the drop-down menu
/* 无限级分类 * * 逻辑递推获取类型 * hid 上级栏目id * step 下级栏目前缀 * tid seleted选项id */ function LogicGetTypeList($datatable='lanmu_class',$hid=0,$step='',$tid=-1) { static $TypeList=''; $query = "SELECT * FROM `$datatable` WHERE heid=$hid ORDER BY px ASC"; $arrs=mysql_query($query); while($row=@mysql_fetch_assoc($arrs)){ echo $step; $TypeList .= ("\r\n"); //分类名称 LogicGetTypeList($datatable,$row['id'],$step.'--',$tid); } return $TypeList; }
The code is roughly as follows and needs to be modified according to the specific situation
The above introduces the implementation of unlimited classification in PHP, including the content of PHP and unlimited levels. I hope it will be helpful to friends who are interested in PHP tutorials.