//获取指定类型的子分类
function getAllChildcateIds($categoryID,$table){
//初始化ID数组
$array[] = $categoryID;
do
{
$ids = '';
$where['pid'] = array('in',$categoryID);
$cate = M($table)->where($where)->select();
//循环二级分类
foreach ($cate as $k=>$v)
{
$array[] = $v['id'];
$ids .= ',' . $v['id'];
}
$ids = substr($ids, 1, strlen($ids));
$categoryID = $ids;
}
while (!empty($cate));
$ids = implode(',', $array);
return $ids; // 返回字符串
//return $array //返回数组
}