前言

不说废话,直接上干货√

参考格式如下:

{
    "tertiary": [
        {
            "value": "110000",
            "text": "北京市",
            "children": [
                {
                    "value": "110100",
                    "text": "北京市",
                    "children": [
                        {
                            "value": "110101",
                            "text": "东城区"
                        },
                        {
                            "value": "110102",
                            "text": "西城区"
                        },
                        {
                            "value": "110105",
                            "text": "朝阳区"
                        },
                        {
                            "value": "110106",
                            "text": "丰台区"
                        },
                        {
                            "value": "110107",
                            "text": "石景山区"
                        },
                        {
                            "value": "110108",
                            "text": "海淀区"
                        },
                        {
                            "value": "110109",
                            "text": "门头沟区"
                        },
                        {
                            "value": "110111",
                            "text": "房山区"
                        },
                        {
                            "value": "110112",
                            "text": "通州区"
                        },
                        {
                            "value": "110113",
                            "text": "顺义区"
                        },
                        {
                            "value": "110114",
                            "text": "昌平区"
                        },
                        {
                            "value": "110115",
                            "text": "大兴区"
                        },
                        {
                            "value": "110116",
                            "text": "怀柔区"
                        },
                        {
                            "value": "110117",
                            "text": "平谷区"
                        },
                        {
                            "value": "110118",
                            "text": "密云区"
                        },
                        {
                            "value": "110119",
                            "text": "延庆区"
                        }
                    ]
                }
            ]
        },
    ]
}
<?php
 $tertiary=[
  "tertiary" => [
    [
      "value" => "110000",
      "text" => "北京市",
      "children" => [
        [
          "value" => "110100",
          "text" => "北京市",
          "children" => [
            [
              "value" => "110101",
              "text" => "东城区"
            ],
            [
              "value" => "110102",
              "text" => "西城区"
            ],
            [
              "value" => "110105",
              "text" => "朝阳区"
            ],
            [
              "value" => "110106",
              "text" => "丰台区"
            ],
            [
              "value" => "110107",
              "text" => "石景山区"
            ],
            [
              "value" => "110108",
              "text" => "海淀区"
            ],
            [
              "value" => "110109",
              "text" => "门头沟区"
            ],
            [
              "value" => "110111",
              "text" => "房山区"
            ],
            [
              "value" => "110112",
              "text" => "通州区"
            ],
            [
              "value" => "110113",
              "text" => "顺义区"
            ],
            [
              "value" => "110114",
              "text" => "昌平区"
            ],
            [
              "value" => "110115",
              "text" => "大兴区"
            ],
            [
              "value" => "110116",
              "text" => "怀柔区"
            ],
            [
              "value" => "110117",
              "text" => "平谷区"
            ],
            [
              "value" => "110118",
              "text" => "密云区"
            ],
            [
              "value" => "110119",
              "text" => "延庆区"
            ]
          ]
        ]
      ]
    ],
  ]
]
<?xml version="1.0" encoding="UTF-8" ?>
<tertiary>
<value>110000</value>
<text>北京市</text>
<children>
<value>110100</value>
<text>北京市</text>
<children>
<value>110101</value>
<text>东城区</text>
</children>
<children>
<value>110102</value>
<text>西城区</text>
</children>
<children>
<value>110105</value>
<text>朝阳区</text>
</children>
<children>
<value>110106</value>
<text>丰台区</text>
</children>
<children>
<value>110107</value>
<text>石景山区</text>
</children>
<children>
<value>110108</value>
<text>海淀区</text>
</children>
<children>
<value>110109</value>
<text>门头沟区</text>
</children>
<children>
<value>110111</value>
<text>房山区</text>
</children>
<children>
<value>110112</value>
<text>通州区</text>
</children>
<children>
<value>110113</value>
<text>顺义区</text>
</children>
<children>
<value>110114</value>
<text>昌平区</text>
</children>
<children>
<value>110115</value>
<text>大兴区</text>
</children>
<children>
<value>110116</value>
<text>怀柔区</text>
</children>
<children>
<value>110117</value>
<text>平谷区</text>
</children>
<children>
<value>110118</value>
<text>密云区</text>
</children>
<children>
<value>110119</value>
<text>延庆区</text>
</children>
</children>
</tertiary>


GeorgieのBlog,分享生活的点点滴滴,分享代码干货