How to set php header encoding

藏色散人
Release: 2023-03-12 13:00:02
Original
2096 people have browsed it

In PHP, you can set the encoding by adding the "header("Content-type: text/html; charset=utf-8");" statement to the header of the PHP file.

How to set php header encoding

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

How to set the php header encoding?

The code for setting utf encoding is as follows:

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

Note: Usually the above code is placed on the home page of the php page

The header() function sends the original to the client HTTP header.

Attachment:

The php page is encoded by gbk

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

The php page is encoded by big5

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

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to set php header encoding. For more information, please follow other related articles on the PHP Chinese website!

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!