Home >Backend Development >PHP Problem >How to change file encoding format in php
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 ");".
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:
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!