/**
* 递归转换数组或字符串的编码格式 * @param array $arr * @param string $fromeEncoding * @param string $toEncoding * $arr*/function array_iconv($arr, $fromEncoding, $toEncoding){ if(is_string($arr)) { if (function_exists('mb_convert_encoding')) return mb_convert_encoding($arr, $toEncoding, $fromEncoding); elseif (function_exists('iconv')) return iconv($fromEncoding, $toEncoding, $arr); else return $arr; } else if(is_array($arr)) { foreach ($arr as $key => $value) { $_key = array_iconv($key, $fromEncoding, $toEncoding); $arr[$_key] = array_iconv($value, $fromEncoding, $toEncoding); if($_key != $key) unset($arr[$key]); } return $arr; } else { return $arr; }}