码迷,mamicode.com
首页 > 编程语言 > 详细

二维数组遍历查询数据

时间:2015-10-30 14:04:23      阅读:286      评论:0      收藏:0      [点我收藏+]

标签:

$area_list==>
Array
(
    [0] => Array
        (
            [ap] => 19
            [ac] => 512962
            [ax] => 513621
        )

    [1] => Array
        (
            [ap] => 1
            [ac] => 32
            [ax] => 256
        )

    [2] => Array
        (
            [ap] => 16
            [ac] => 409220
            [ax] => 412722
        )
)

foreach($area_list as $k2=>$v2){
   foreach ($v2 as $k3=>$v3) {              
        $map[‘id‘]=$v3;
        $area_full_names[$k2][$k3]=M(‘area‘)->where($map)->getField(‘title‘);
   }
}

$area_full_names==>
Array
(
    [0] => Array
        (
            [ap] => 广东
            [ac] => 深圳市
            [ax] => 龙岗区
        )

    [1] => Array
        (
            [ap] => 北京
            [ac] => 北京
            [ax] => 西城区
        )


    [2] => Array
        (
            [ap] => 宁夏
            [ac] => 银川市
            [ax] => 贺兰县
        )
)

 

二维数组遍历查询数据

标签:

原文地址:http://www.cnblogs.com/719907411hl/p/4922895.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!