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

把一维数组处理成二维数组

时间:2015-08-11 13:37:05      阅读:125      评论:0      收藏:0      [点我收藏+]

标签:

array (size=3)
  ‘幸运抽奖‘ => 
    array (size=4)
      ‘开宝箱‘ => string ‘http://baidu.com‘ (length=16)
      ‘大转盘‘ => string ‘‘ (length=0)
      ‘砸金蛋‘ => string ‘‘ (length=0)
      ‘刮刮乐‘ => string ‘‘ (length=0)
  ‘积分兑换‘ => 
    array (size=4)
      ‘兑换砖石‘ => string ‘‘ (length=0)
      ‘兑换体力‘ => string ‘‘ (length=0)
      ‘兑换金币‘ => string ‘‘ (length=0)
      ‘兑换VIP卡‘ => string ‘‘ (length=0)
  ‘个人中心‘ => 
    array (size=5)
      ‘我的订单‘ => string ‘‘ (length=0)
      ‘我的积分‘ => string ‘‘ (length=0)
      ‘积分排名‘ => string ‘‘ (length=0)
      ‘兑换记录‘ => string ‘‘ (length=0)
      ‘商城主页‘ => string ‘‘ (length=0)



	/**
	 * 商城底部菜单
	 */
	public function bottom(){
		$map["status"]="1";
		$map["praent_id"]="0";
		$praent_data=M("wx_shop_menu")->where($map)->select();
		$shop_menu_data=array();
		foreach ($praent_data as $key => $val){
			$shop_menu_data[$val[‘menu_name‘]]=$this->menu_childs($val[‘id‘]);
		}
		$this->assign("shop_menu_data",$shop_menu_data);
		$this->display();
	}
	/**
	 * 获取子类
	 */
	public function menu_childs($praent_id){
		$map["praent_id"] = $praent_id;
		$data = M("wx_shop_menu")->where($map)->select();
		$childs_data = array();
		foreach ($data as $key => $val){
			$childs_data[$val[‘menu_name‘]] = $val[‘url‘];
		}
		return $childs_data;
		
	}

  

把一维数组处理成二维数组

标签:

原文地址:http://www.cnblogs.com/hgj123/p/4720520.html

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