public 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; }
为什么我这样写只能得到张三和李四的数据,却得不到小明的数据?
手掌心
相关分类