Home > Backend Development > PHP Problem > How to set the encoding in php to gbk encoding

How to set the encoding in php to gbk encoding

藏色散人
Release: 2023-03-02 22:58:01
Original
4978 people have browsed it

How to set php encoding to gbk encoding: first open the PHP page that needs to set the encoding; then add the code statement to the home page of the PHP page as "header("Content-type: text/html; charset=gb2312 ");"; Just save it at the end.

How to set the encoding in php to gbk encoding

php sets the encoding by default to utf8 encoding

utf encoding:

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

gbk encoding:

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

big5 encoding:

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

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

Recommended: "PHP Tutorial"

The above is the detailed content of How to set the encoding in php to gbk 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template