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.
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('Content-type:text/html;charset=utf-8'); ?>
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!