无限循环模式,一维数组如何循环出来?

浏览:1329 发布日期:2016/01/29 分类:求助交流
三级分销的程序,是thinkphp写的。原来的功能是我可以看见我发展一级二级三级所有用户,我现在想用无限循环模式。输出N级的用户。就是三级之后发展的我都能看见。
就是我可以看到所有用户。。
包括我三级发展的
无限循环!    public function member_pc()
    {
        if ($_GET ['id'] && $_GET ['type']) {
            $type = $_GET ['type'];
            import('ORG.Util.Page');
            $id = $_GET ["id"];
            $user = htmlspecialchars($_GET ["user"]);
            $where = array('id' => $id);
            $usersresult = M("User")->where($where)->find();
            if (empty($usersresult)) {
                exit('未查到该用户信息');
            }
            //分销保持资格
            $this->fenxiao_zige($usersresult);
            $this->assign("users", $usersresult);
            $count_desc = "TA的:";
            if ($type == 1) {
                $where = array('l_id' => $id);
            } else if ($type == 2) {
                $where = array('l_b' => $id);
            } else if ($type == 3) {
                $where = array('l_c' => $id);
            }
            if (!empty($user)) {
                $where['id'] = $user;
            }

            $count = M("User")->where($where)->count();

            if ($type == 1) {
                $count_desc .= "一级下线($count)人";
            } else if ($type == 2) {
                $count_desc .= "二级下线($count)人";
            } else if ($type == 3) {
                $count_desc .= "三级下线($count)人";
            }
            $Page = new Page ($count, 20);
            $Page->setConfig('header', '人');
            $Page->setConfig('theme', '<li><a>%totalRow% %header%</a></li> <li>%upPage%</li> <li>%downPage%</li> <li>%first%</li>  <li>%prePage%</li> <li>%end%</li> '); //(对thinkphp自带分页的格式进行自定义)
            $show = $Page->show(); // 分页显示输出
            $result = M("User")->where($where)->limit($Page->firstRow . ',' . $Page->listRows)->select();
            $this->assign("result", $result);
            $this->assign("page", $show);
            $this->assign("count_desc", $count_desc);
            $info = R("Api/Api/gettheme");
            C("DEFAULT_THEME", $info ["theme"]);
            $this->assign("info", $info);

            $this->assign("dongjia_time", $this->dongjia_time);

            $this->display();
        }
    }
选择一个顶级id找到所有其下属id

哪位大神帮忙看下。或者能写个样例啊。大神啊,你在哪儿
最佳答案
评论( 相关
后面还有条评论,点击查看>>