这样的json如何生成啊
程序员文章站
2022-05-14 09:57:38
...
这样的json怎么生成啊,
目标:生成一个树型菜单。
数据库,如下:
我在后台,如何用Php生成如下josn,那他们显示出来啊?
json格式如下:
------解决思路----------------------
参考:
http://bbs.csdn.net/topics/390364669
http://bbs.csdn.net/topics/390524563
目标:生成一个树型菜单。
数据库,如下:
我在后台,如何用Php生成如下josn,那他们显示出来啊?
json格式如下:
var json = [{"name":"*a","list":[
{"name":"**a","url":"#a1"},
{"name":"**aa","list":[{"name":"***a","url":"#a11"},{"name":"***aa","list":[{"name":"****a","url":"#a111"},{"name":"****aa","list":[{"name":"*****a","url":"#a1111"},{"name":"*****aa","url":"#a1112"}]}
]},
{"name":"***aaa","url":"#a13"},{"name":"***aaaa","url":"#a14"}]},{"name":"**a","url":"#a3"}]},
{"name":"*b","list":[
{"name":"**b","url":"#b1"},
{"name":"**bb","list":[
{"name":"****b","url":"#b111"},
{"name":"****bb","url":"#b112"}
]
},
]
},
{"name":"*c","list":[
{"name":"**c","url":"#c1"},
{"name":"**cc","url":"#c2"}
]
},
{"name":"*d"}
]
------解决思路----------------------
参考:
http://bbs.csdn.net/topics/390364669
http://bbs.csdn.net/topics/390524563
相关文章
相关视频