Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
clouds-flight authored Jun 9, 2020
1 parent 6f1a00f commit 6a0d3c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# array-tree
带有树结构的数组(含parent_id)非递归转为包含层级的树结构数组
带有树结构的数组(含parent_id)非递归生成包含层级的树结构数组

只是遍历了一遍所有数据,和指定父元素及其下所有子元素,未使用递归,理论上可以支持无限层级

Expand Down Expand Up @@ -44,7 +44,7 @@
"name": "添加友情链接提交保存"
}]
获取包含层级结构的数组
生成包含层级结构的数组

ArrayTree::getTree($array,id); //$array 包含树结构关系的数组(需包含 id parent_id name),$id 父id ,会返回该父id下的所有子级元素(层级结构)
结果如下:
Expand Down Expand Up @@ -96,7 +96,7 @@
}]


获取包含层级结构的数组,并添加名称路径
生成包含层级结构的数组,并添加名称路径

ArrayTree::getTreePath($res,$id,$separator); //$array 包含树结构关系的数组(需包含 id parent_id name),$id 父id ,会返回该父id下的所有子级元素(层级结构),$separator 路径分隔符
结果如下(分隔符是/,因转为json字符串添加了转义符,解码后是没有\的):
Expand Down

0 comments on commit 6a0d3c5

Please sign in to comment.