\laytp\libraryTree

通用树型类 - laytp极速后台框架

Summary

Methods
Properties
Constants
instance()
init()
getRootTrees()
getTrees()
getChildIds()
getParentIds()
$map
$mapName
$pidName
$childName
No constants found
No protected methods found
$instance
N/A
No private methods found
No private properties found
N/A

Properties

$map

$map : array

生成树型结构所需要的2维数组

Type

array

$mapName

$mapName : 

Type

$pidName

$pidName : 

Type

$childName

$childName : 

Type

$instance

$instance : 

Type

Methods

init()

init(  $arr = array()) : $this

初始化方法 注意,参数一定要是数组,数据库select()->toArray();否则调用getRootTree会内存溢出

Parameters

$arr

Returns

$this

getRootTrees()

getRootTrees() : array

获取所有根树

Returns

array

getTrees()

getTrees() 

获取所有树

getChildIds()

getChildIds(  $ids, boolean  $withSelf = true) : array

获取某ID的所有子级ID

Parameters

$ids

string|array 要查询子级的ID

boolean $withSelf

返回的结果是否包含$ids

Returns

array

getParentIds()

getParentIds(  $ids, boolean  $withSelf = true) : array

获取某ID的所有父级ID

Parameters

$ids

string|array 要查询父级的ID

boolean $withSelf

返回的结果是否包含$id

Returns

array