search

Home  >  Q&A  >  body text

php通过fread()读取文件内容,中文字符乱码怎么解决?

php中,通过fread函数直接读取文件,文件内容如果遇到中文则会出现乱码问题,这个该如何去解决?

我想大声告诉你我想大声告诉你2738 days ago1456

reply all(2)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-16 13:12:49

    Try transcoding the content after reading it

    iconv('gbk', 'utf-8', $data)

    reply
    0
  • 黄舟

    黄舟2017-05-16 13:12:49

    That’s because the encoding of your output page is inconsistent with the encoding of the file being read

    reply
    0
  • Cancelreply