Home > Backend Development > PHP Tutorial > 为什么直接用php输出静态页面会出现乱码?

为什么直接用php输出静态页面会出现乱码?

PHPz
Release: 2020-06-23 09:17:41
Original
1412 people have browsed it

为什么直接用php输出静态页面会出现乱码?

为什么直接用php输出静态页面会出现乱码?

具体问题:

我直接写了个php文件

<html>
<head>
<title>你好世界</title>
</head>
你好世界
</html>
Copy after login

结果为什么会变成这样?

回答方法:

PHP:

header("Content-type: text/html; charset=utf-8");
Copy after login

既然是HTML页面,指定charset也是必要的:

<meta charset="UTF-8" />
Copy after login

更多相关技术文章,请访问PHP中文网

Related labels:
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 Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template