Home  >  Article  >  Backend Development  >  How to modify file encoding in php

How to modify file encoding in php

藏色散人
藏色散人Original
2020-07-29 11:04:154233browse

php method to modify file encoding: 1. Modify the encoding format of the php file itself; 2. In the php file content, set the encoding format required for browser parsing, set statements such as "header(" Content-type: text/html; charset=utf-8");".

How to modify file encoding in php

Recommendation: "PHP Tutorial"

There are two places related to PHP encoding:

1. The encoding format of the php file itself:

The operation method is different depending on the software used to write php, such as phpDesigher software:

How to modify file encoding in php

2. In the php file content, you need to set the encoding format required for browser parsing:

In the PHP file code, insert

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

which is equivalent to html's

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

The above is the detailed content of How to modify file encoding in php. 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