我的程序代码: public function getList($id){ $Attribute = M('Attribute'); $list = $Attribute->field('attr_id,attr_name,attr_values')->where("cat_id={$id}")->select();
foreach($list as $row){ foreach($row as $key=>$value){ if($key=='attr_values'&& !empty($value)){ $tree['attr_values']=explode("\r\n",$value); } } $tree[]=$row; } return $list; }