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

WBOY
Release: 2016-06-13 12:27:18
Original
736 people have browsed it

thinkphp3.1放到IIS上出现乱码,apache上正常这个是怎么回事?
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编码试试,或者更改下浏览器的编码。
------解决思路----------------------
thinkphp是使用utf8编码格式的。
可以在文件顶部加上

<br />header('content-type:text/html;charset=utf8');<br />
Copy after login

------解决思路----------------------
肯定是编码问题啦,不是编码问题怎么会乱码。
------解决思路----------------------
不是文件编码问题,而是输出的编码问题。

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!