header('content-type:text/html;charset=gbk');
if(!empty($_GET['parent_id'])){
$id1 = M('goods_category')->where('id='.$_GET['id'])->find();
}elseif(!empty($_GET['id'])){
$id1 = M('goods_category')->where('parent_id='.$_GET['id'])->find();
}else{
$id1 = M('goods_category')->where('parent_id=1')->find();
}
if(!empty($id1['cat_group'])){
$hostdir = './public/images/'.$id1['cat_group'].'/';
$url = "./public/images/".$id1['cat_group'].'/';
$filesnames = scandir($hostdir); //得到所有的文件
$count = count($filesnames)-2;
$www = 'http://localhost/'; //域名
$aurl = array();
foreach ($filesnames as $k => $name) {
if($name == '.' || $name == ".."){
unset($name);
}else{
$aurl[$k]['img']= iconv('gbk','utf-8',$www.$url.$name); //图片
}
}
}else{
$aurl = '';
}