Home  >  Article  >  Backend Development  >  thinkphp3.1放到IIS上出现乱码,apache上正常这个是怎么回事?

thinkphp3.1放到IIS上出现乱码,apache上正常这个是怎么回事?

WBOY
WBOYOriginal
2016-06-20 12:44:40944browse

thinkphp3.1放到IIS上出现乱码,apache上正常这个是怎么回事?不要说编码的问题,我查了数据库和配置文件,都是UTF-8,还有生成的缓存文件是正常的,也是UTF-8的


回复讨论(解决方案)

thinkphp 默认字符集是 utf-8
但是他的代码中一句 header("Content-Type:text/html; charset=utf-8"); 都没有
这样当他在 IIS 中运行时,就可能会出问题。因为 IIS 默认会发一个系统字符集的头,对于简体中文系统就是 Content-Type:text/html; charset=gb2312
于是乱码就产生了

程序运行的时候,声明下header编码试试,或者更改下浏览器的编码。

肯定是编码问题啦,不是编码问题怎么会乱码。

不是文件编码问题,而是输出的编码问题。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn