/** * 将多维数组合并为一维数组 * * @param $array 需要合并的数组 * @param bool $clearRepeated 是否清除并后数组中的重复值 * @return array|bool */ public function arrayMultiToSingle($array,$clearRepeated = false){ if(!isset($array) || !is_array($array) || empty($array)){ return false; } if(!in_array($clearRepeated,array('true','false',''))){ return false; } $result = array(); foreach($array as $value){ if(is_array($value)){ $this->arrayMultiToSingle($value); }else{ $result[] = $value; } } if($clearRepeated){ $result = array_unique($result); } return $result;