使用php mysql的层次结构树

时间:2016-10-22 17:59:26

标签: php mysql json tree

[
  {
    "lev1": "ELECTRONICS",
    "lev2": "PORTABLE ELECTRONICS",
    "lev3": "MP3 PLAYERS",
    "lev4": "FLASH"
  },
  {
    "lev1": "ELECTRONICS",
    "lev2": "TELEVISIONS",
    "lev3": "TUBE",
    "lev4": null
  },
  {
    "lev1": "ELECTRONICS",
    "lev2": "TELEVISIONS",
    "lev3": "LCD",
    "lev4": null
  },
  {
    "lev1": "ELECTRONICS",
    "lev2": "TELEVISIONS",
    "lev3": "PLASMA",
    "lev4": null
  },
  {
    "lev1": "ELECTRONICS",
    "lev2": "PORTABLE ELECTRONICS",
    "lev3": "CD PLAYERS",
    "lev4": null
  },
  {
    "lev1": "ELECTRONICS",
    "lev2": "PORTABLE ELECTRONICS",
    "lev3": "2 WAY RADIOS",
    "lev4": null
  }
]

我有上面的json,我想从中创建分层树。

怎么做?

0 个答案:

没有答案