- 定义一个私有的数组属性
- private $members=array();
- 递归查询:
/*
* 递归查询给当前用户有关系的所有用户
* $userid 查询的用户 referee_id上级的uid
*/
public function Recursion($userid){
//查询当前用户的下一级
$Huomerbers=M("user")->where("referee_id='{$userid}'")->select();
$this->members=array_merge($this->members,$Huomerbers);
if(count($Huomerbers) > 0){
foreach($Huomerbers as $value){
$this->Recursion($value['userid']);
}
}
}