搜索
系统检测到您的用户名不符合规范:

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

浏览:1327 发布日期: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

哪位大神帮忙看下。或者能写个样例啊。大神啊,你在哪儿
最佳答案
评论() 相关
后面还有条评论,
评论支持使用[code][/code]标签添加代码
您需要登录后才可以评论 登录 | 立即注册
收藏
sofeet
积分:326 等级:LV2
热点推荐
(追記) (追記ここまで)
最新更新

我们

合作

网站

信息

ThinkPHP 是一个免费开源的,快速、简单的面向对象的 轻量级PHP开发框架 ,创立于2006年初,遵循Apache2开源协议发布,是为了敏捷WEB应用开发和简化企业应用开发而诞生的。ThinkPHP从诞生以来一直秉承简洁实用的设计原则,在保持出色的性能和至简的代码的同时,也注重易用性。并且拥有众多的原创功能和特性,在社区团队的积极参与下,在易用性、扩展性和性能方面不断优化和改进,已经成长为国内最领先和最具影响力的WEB应用开发框架,众多的典型案例确保可以稳定用于商业以及门户级的开发。

AltStyle によって変換されたページ (->オリジナル) /