Home  >  Article  >  Backend Development  >  How to change file encoding format in php

How to change file encoding format in php

藏色散人
藏色散人Original
2021-06-27 11:24:342952browse

php method to change the file encoding format: 1. Modify the encoding according to the software used to write PHP; 2. Add "header("Content-type: text/html; charset=utf-8 to the PHP file ");".

How to change file encoding format in php

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

How does php change the file encoding format?

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 change file encoding format 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

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

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to change file encoding format 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