/** * GBK ASCII 转换成utf8 */ public function to_utf8($str){ $detect = array('ASCII', 'GBK', 'UTF-8'); $encoding = mb_detect_encoding($str, $detect); $str = mb_convert_encoding($str, 'UTF-8', $encoding); return $str; }