日期:2014-05-17 浏览次数:20456 次
$content = file_get_contents($url); $encode = mb_detect_encoding($content,'CP936,UTF-8') ; //如果是CP936,就是gbk编码,如果是UTF-8, 就是utf-8编码 if ($encode =='CP936') { //再调用转换成utf-8编码的函数,最终确保是utf-8 $content = mb_convert_encoding ($content, 'UTF-8' ,'GBK'); } echo $content;