$info = D('Shopclass')->where('state = 0')->select();
$shopClass = D('Shopclass')->getShopClassIndex($info);
/**
* 获取首页商家分类无限极递归 ** @author shaobaojie 26416@163.com
*/
public function getShopClassIndex($info,$pid=0){
$arr=array();
foreach ($info as $key=>$val){
if($val['pid']==$pid){
$val['child']=$this->getShopClassIndex($info,$val['id']);
$arr[]=$val;
}
}
return $arr;
}