自动把未知编码的文件转换为目标编码
<?php
function get_encoding($data,$to){
$encode_arr = array('UTF-8','ASCII','GBK','GB2312','BIG5','JIS','eucjp-win','sjis-win','EUC-JP');
$encoded = mb_detect_encoding($data, $encode_arr);
$data = mb_convert_encoding($data,$to,$encoded);
return $data;
}
// get_encoding($data,"GB2312");
?>