标签:架构 session _id pat 方法 while div class php
根据所得到的部门编号获取顶级部门ID:
参数 - department_id
表格组织架构:
tab_departments
department_id parent_id name
1 1 顶级
2 1 第一级
.......
函数:
1 function getDepartmentId($department_id){ 2 $departments = M(‘tab_departments‘)->getField(‘department_id,parent_id‘); 3 4 while($departments[$department_id]>1){ 5 $department_id = $departments[$department_id]; 6 } 7 }
调用方法:
$department_id = session(‘department_id‘);//当前用户的岗位ID $top_id = getDepartmentId($depatment_id); dump($top_id);
标签:架构 session _id pat 方法 while div class php
原文地址:http://www.cnblogs.com/Aylin-PHPer/p/6259880.html