直接上代码
function str_to_utf8 ($str = '') {
$current_encode = mb_detect_encoding($str, array("ASCII","GB2312","GBK",'BIG5','UTF-8'));
$encoded_str = mb_convert_encoding($str, 'UTF-8', $current_encode);
return $encoded_str;
}
function str_to_utf8 ($str = '') {
$current_encode = mb_detect_encoding($str, array("ASCII","GB2312","GBK",'BIG5','UTF-8'));
$encoded_str = mb_convert_encoding($str, 'UTF-8', $current_encode);
return $encoded_str;
}