Home  >  Article  >  Backend Development  >  nestable-lists - 我如何使用PHP嵌套项目的任何数量的处理嵌套的输出?

nestable-lists - 我如何使用PHP嵌套项目的任何数量的处理嵌套的输出?

WBOY
WBOYOriginal
2016-06-06 20:13:08886browse

nestable lists,我在数据库中读出Jason如何嵌套输出到页面
[{"id":1,"children":[{"id":2},{"id":3,"children":[{"id":4}]}]}]

回复内容:

nestable lists,我在数据库中读出Jason如何嵌套输出到页面
[{"id":1,"children":[{"id":2},{"id":3,"children":[{"id":4}]}]}]

json 输出到页面,对于页面来说,不就是一些字符串
如果原始就是json字符串数据,直接在页面echo 就可以了
如果原始数据是数组,或者可以处理成数组,直接 echo json_encode($array)

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn