PHP gbk转换成utf8

/**
* 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;
}

posted @ 2014-04-04 17:58  siyed  Views(203)  Comments(0Edit  收藏  举报