Home >Backend Development >PHP Tutorial >这样的json如何生成啊

这样的json如何生成啊

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:16:251184browse

这样的json怎么生成啊,
目标:生成一个树型菜单。
数据库,如下:

我在后台,如何用Php生成如下josn,那他们显示出来啊?
json格式如下:

var json = [{"name":"*a","list":[<br />		{"name":"**a","url":"#a1"},<br />			{"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"}]}<br />			]},<br />			{"name":"***aaa","url":"#a13"},{"name":"***aaaa","url":"#a14"}]},{"name":"**a","url":"#a3"}]},<br />			{"name":"*b","list":[<br />								{"name":"**b","url":"#b1"},<br />								{"name":"**bb","list":[<br />																	{"name":"****b","url":"#b111"},<br />																	{"name":"****bb","url":"#b112"}<br />																   ]<br />								},<br />								]<br />			},<br />			{"name":"*c","list":[<br />								{"name":"**c","url":"#c1"},<br />								{"name":"**cc","url":"#c2"}<br />								]<br />			},<br />			{"name":"*d"}<br />		   ]

------解决思路----------------------
参考:
http://bbs.csdn.net/topics/390364669
http://bbs.csdn.net/topics/390524563

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