Get the App
SLTechnology News&Howtos  ›  Development  › 

How to set the php header encoding

Shulou Source: shulou.com Published: 2022-06-03 14:15:31 11月14日 Update

This article is about how to set the php header encoding. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

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

The code to set the utf encoding is as follows:

Header ("Content-type: text/html; charset=utf-8")

Note: the above code is usually placed on the front page of the php page

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

Attached:

Php pages are encoded for gbk

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

Php pages are encoded for big5

Header ("Content-type: text/html; charset=big5"); Thank you for reading! This is the end of the article on "how to set the php header code". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Tags: Code page code content more article good original practical function can pass header client client situation header file article see knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Xiaomi NVidia macOS Microsoft