字符集转换
将GB2312转成UTF-8
方法一:echo iconv('GB2312', 'UTF-8', $str); //将字符串的编码从GB2312转到UTF-8
方法二:mb_convert_encoding($str, "UTF-8", "GB2312");
注:如果字符集中有些是gb2312的有些是gbk的要转成utf-8,统一以gbk进行转换:iconv('gbk','utf-8',$str);
如果不知道源字符集是啥,可以设置成自动识别,转成utf-8:mb_convert_encoding($str,'utf-8','auto');
时不我待,不负韶华!立刻行动!不吃学习的苦就会吃生活的苦!