数组转json 结构的转换

WBOY
发布: 2016-06-23 09:15:08
原创
980 人浏览过

我的数组是Array
(
    [1] => Array
        (
            [aid] => 1
            [pid] => 0
            [brand] => young
            [id] => 2
            [uname] => young1
            [groups] => 3
            [sub] => Array
                (
                    [2] => Array
                        (
                            [aid] => 1
                            [pid] => 2
                            [brand] => young
                            [id] => 3
                            [uname] => young2
                            [groups] => 4
                        )

                    [3] => Array
                        (
                            [aid] => 1
                            [pid] => 2
                            [brand] => young
                            [id] => 4
                            [uname] => young3
                            [groups] => 4
                        )

                )

        )这样的 
我用json转是这样的

如何把画圈的去掉,因为这样app解析不了


回复讨论(解决方案)

$new_data = array();foreach ($data as $itm) {	$itm['sub'] = array_values($itm['sub']);	$new_data[] = $itm;}
登录后复制

来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板