首先要保证整个php文件是utf-8的格式 //最好写上去,因为这也可能是页面没有设置字符集 echo ''; //获得字符串之后马上把字符串转成另一种编码 $content = file_get_contents("800.txt"); $content = mb_convert_encoding($content, 'utf-8'