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

How to set the encoding in php to gbk encoding

藏色散人
藏色散人Original
2020-07-23 10:12:054792browse

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");

gbk encoding:

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

big5 encoding:

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

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!

Statement:
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