时间:2021-07-01 10:21:17 帮助过:21人阅读
$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;