求助:nginx+php中文总是乱码

WBOY
Release: 2016-06-13 12:14:12
Original
1200 people have browsed it

求援:nginx+php中文总是乱码
已经做过的尝试:
1. 将Linux的字符集改为zh_cn.utf-8
2. 已经将nginx中charset设为 utf-8
3. php文件存为utf-8格式
4. 在php文件头加了


但是打开网页还是无法显示中文。

具体php文件如下:






@header('Content-type: text/html;charset=UTF-8');
echo "我的第一段 PHP 脚本!";
?>



打开网页输出为:
????? PHP ??!
------解决思路----------------------
引用:
Quote: 引用:

"; charset= "utf-8" />

少了两个 ”


谢谢!
改过了也没有,还是老样子。所有的汉字都变成了?


引用:
Quote: 引用:

"; charset= "utf-8" />

少了两个 ”


谢谢!
改过了也没有,还是老样子。所有的汉字都变成了?

不好意思 我说错了! 因为这种头部代码都写在配置文件里 好久不写了 刚刚看了一下是这样!
header("Content-Type: text/html; charset=utf-8"); //这个应该写在php文件头部
Copy after login

 
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
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!