亮点在于:对数组的键名也进行了转换。
推荐方法:
<?php
function array_iconv($arr, $fromCharset, $toCharset){
if(is_array($arr)){
$arr1 = array();
foreach($arr as $key => $value){
$key = iconv($fromCharset, $toCharset, $key);
$arr1[$key] = array_iconv($value, $fromCharset, $toCharset);
}
}else{
...