php字符串编码转换
function phpcharset($data, $to) { if(is_array($data)) { foreach($data as $key => $val) { $data[$key] = phpcharset($val, $to); } } else { $encode_array = array('ASCII', 'UTF-8', 'GBK', 'GB2312', 'BIG5'); $encoded = mb_detect_encoding($data, $encode_array); $to = strtoupper($to); if($encoded != $to) { $data = mb_convert_encoding($data, $to, $encoded); } } return $data; }