数据输出问题
本帖最后由 jy02409187 于 2014-01-10 11:53:14 编辑
现在有三张表,一级分类,二级分类,三级分类
一级分类 catalog
id name rank
1 a1 99
2 a2 98
二级分类 subCatalog
id name catalogId catalogName rank
1 b1 1 a1 99
2 b2 1 a1 98
3 b3 2 a2 97
4 b4 2 a2 96
三级分类 threeCatalog
id name catalogId catalogName subCatalog subCatalogName rank
1 c1 1 a1 1 b1 99
2 c2 1 a1 1 b1 98
3 c3 1 a1 2 b2 97
4 c4 2 a2 3 b3 96
5 c5 2 a2 4 b4 95
请问用PHP怎么输出一个如下的JSON数组啊
{"catalog":[{
"id" : 1,
"name" : "a1",
"subCatalog" : [{
"id" : 1,
"name" : "b1",
"threeCatalog" : [{
"id" : 1,
"name" : "c1"
}, {
"id"&nb