/** * Short description. * * Detail description * @param none * @global none * @since 1.0 * @access private * @return void * @update date time */ function getValue ($id) { return $this->data[$id]; } // end func
/** * Short description. * * Detail description * @param none * @global none * @since 1.0 * @access private * @return void * @update date time */ function getLayer ($id, $space = false) { return $space?str_repeat($space, $this->layer[$id]):$this->layer[$id]; } // end func
/** * Short description. * * Detail description * @param none * @global none * @since 1.0 * @access private * @return void * @update date time */ function getParent ($id) { return $this->parent[$id]; } // end func
/** * Short description. * * Detail description * @param none * @global none * @since 1.0 * @access private * @return void * @update date time */ function getParents ($id) { while ($this->parent[$id] != -1) { $id = $parent[$this->layer[$id]] = $this->parent[$id]; }
ksort($parent); reset($parent);
return $parent; } // end func
/** * Short description. * * Detail description * @param none * @global none * @since 1.0 * @access private * @return void * @update date time */ function getChild ($id) { return $this->child[$id]; } // end func
/** * Short description. * * Detail description * @param none * @global none * @since 1.0 * @access private * @return void * @update date time */ function getChilds ($id = 0) { $child = array($id); $this->getList($child, $id);
return $child; } // end func } // end class
?>
使用方法
PHP代码:
复制代码 代码如下: <?php //new Tree(根目录的名字); //根目录的ID自动分配为0 $Tree = new Tree('根目录');
(编辑:焦作站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|