php:树形结构的算法4

<script type="text/javascript"> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
 <? php
  /**
  *显示列表
  *@accesspublic
  */
  functionDispList()
  {
  //不缩进的显示方式
  //$this->mIsDispListIndex=true;
  //echo('<palign="right"><ahref="?action=new&part=role">增加新角色</a> </p>');_fcksavedurl=""?action=new&part=role">增加新角色</a> </p>');"
  //
  //$this->mListTitle='用户角色列表';
  //$this->SetDataOption('list');
  //
  //$this->SetQueryTable(array($this->mTableUserRole));
  //
  查询顺序
  //$this->SetQueryOrder('asc',$this->mTableUserRole,'sequence');
  //
  //$this->Query('list');
  //parent::DispList();
  
  另外一种显示方式,用数组作为堆栈,A:压栈时存role,压完就删除source
  //$this->CheckProperty('mrDb');
  //$this->CheckProperty('mrSql');
  //$this->mrSql->Select('role,title,parent');
  //$this->mrSql->From($this->mTableUserRole);
  //$this->mrSql->Orderby('parent,sequence');
  //$this->mRs=$this->mrDb->Execute($this->mrSql->Sql());
  //if(0<count($this->mRs))
  //{
  //$source=&$this->mRs->GetArray();//数字索引
  //$stack=array('');//堆栈
  //$stacki=array(-1);//和堆栈对应,记录堆栈中数据在树中的层次
  //$target=array();
  //while(0<count($stack))
  //{
  //$item=array_shift($stack);
  //$lev=array_shift($stacki);
  //if(!empty($item))
  //{
  在这里把加工过的数据放到target数组
  //array_push($target,str_repeat('',$lev).$item);
  $s1=str_repeat('',$lev).$item;
  / <script type="text/javascript"> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值