递归查询
public function get_allagent($agentid=0,$ids=[]){ global $_W; $agent1 = pdo_fetchall("select id from " . tablename("ewei_shop_member") . " where agentid=:agentid and uniacid=:uniacid", array(":uniacid" => $_W["uniacid"],":agentid"=>$agentid)); foreach ($agent1 as $key =>$value){ array_push($ids,$value['id']); $agent2 = pdo_fetchall("select id from " . tablename("ewei_shop_member") . " where agentid=:agentid and uniacid=:uniacid", array(":uniacid" => $_W["uniacid"],":agentid"=>$value['id'])); if($agent2){ $ids = $this->get_allagent($value['id'],$ids); } } return $ids; }