分类表:iddepartmentpidlevel1行政部1412市场部1413财务部1414外贸部1415总经办1416投标部1417工程部1418研发部1419销售部14110内销部14111华南区10212华北区10213华东区10214广州0015广东0016样板部151数据表idnamephoneweixinqqemaildid(关联的分类ID)1张三10086test1000010000@qq.com12李四13800138000test1123456123456@qq.com23小明13888888888test2398765498654@qq.com11如$id = 14public function selectRosterList($id)
{
$data = db('department')->where('pid',$id)->select();
$rosters = []; foreach ($data as $key=>$value){
$roster = db('roster')->where('did',$value['id'])->select();
$rosters = array_merge($rosters, $roster); if ($value['pid'] != 0){ $this->selectRosterList($value['id']);
}
} return $rosters;
}为什么我这样写只能得到张三和李四的数据,却得不到小明的数据?
- 2 回答
- 0 关注
- 708 浏览
添加回答
举报
0/150
提交
取消