类如下:
class getUserLeftRightNumber
{
public $arr_all;
public $arr_init;
public $arr_leaf;
public $arr_res;
public function __counstruct()
{
}
public function getUserNum()
{
// ini_set('memory_limit','6144M');
// set_time_limit(0);
// header('content-type:text/html;charset=utf-8');
// define('DB_HOST','127.0.0.1');
// define('DB_USER','root');
// define('DB_PASS','root');
// define('DB_NAME','test');
// define('DB_PORT',3306);
// define('DB_CHAR','utf8');
// define('APPNAME','');
// $mysqli = new mysqli( DB_HOST, DB_USER, DB_PASS, DB_NAME);
// $rst = $mysqli->query( 'set names ' . DB_CHAR );
// $sql = 'select * from ub_user_expand';
// $result=$mysqli->query($sql);
// $array=array();
// while( $rows=$result->fetch_assoc() )
// {
// $r['uid'] = $rows['uid'];
// $r['name'] = $rows['username'];
// $r['_referee'] = $rows['_referee'];
// $r['_left'] = $rows['_left'];
// $r['_right'] = $rows['_right'];
// $r['position'] = $rows['position'];
// $this->arr_all[] = $r;
// }
// print_r($this->arr_all);die();
$this->arr_all[0] = array('uid' => '10000000', '_referee' => '','name' => '101001', '_left' => '10000001', '_right' => '10000002', 'position' => '' );
$this->arr_all[1] = array('uid' => '10000001', '_referee' => '101001', 'name' => '102001', '_left' => '10000003', '_right' => '10000004', 'position' => 1 );
$this->arr_all[2] = array('uid' => '10000002', '_referee' => '101001', 'name' => '102002', '_left' => '10000005', '_right' => '10000006', 'position' => 2 );
$this->arr_all[3] = array('uid'