$str = '';
//拼接的字符串,方便sql调用
foreach ($res as $v){
$str.=','.$v['id'];
}
//去掉第一个逗号
$str = substr($str,1);
//通过sql语句查找到数据
$Goods = M("goods");
$map['parent'] = array( 'IN' , $str);
$goods = $Goods->where($map)->select();
foreach ($res as $v){
$str.=','.$v['id'];
}
//去掉第一个逗号
$str = substr($str,1);
//通过sql语句查找到数据
$Goods = M("goods");
$map['parent'] = array( 'IN' , $str);
$goods = $Goods->where($map)->select();