Home >Backend Development >PHP Problem >How to modify the character set in php

How to modify the character set in php

王林
王林Original
2020-10-12 09:24:363076browse

How to modify the character set in php: directly add the code [header('Content-type:text/html;charset=utf-8');] in the php file. Single-byte encodings and multi-byte encodings can be safely used by PHP.

How to modify the character set in php

If there is a problem with the character encoding displayed in the php file in the browser, then you only need to make the following settings in the php file

( Recommended tutorial: php video tutorial)

<?php
// 服务器读取的  编码设置
header(&#39;Content-type:text/html;charset=utf-8&#39;);
?>

php character encoding requirements:

The following types of encoding can be used safely by PHP.

Single-byte encoding

ASCII compatible (ISO646 compatible), mapping character sets in the range of 00h to 7fh.

Multi-byte encoding

ASCII compatible, mapping character sets in the range of 00h to 7fh. Do not use ISO2022 escape sequences. A single character is expressed in any compound byte, and the values ​​00h to 7fh are not used.

Related tutorials: php training

The above is the detailed content of How to modify the character set 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