Home >Backend Development >PHP Tutorial >PHP plus xmapp Chinese garbled code

PHP plus xmapp Chinese garbled code

不言
不言Original
2018-04-10 10:15:011253browse

The content shared in this article is about the problem of Chinese garbled characters in php plus xmapp. Now I share it with everyone. Friends in need can refer to

php Chinese garbled characters:

a. If you want to use gb2312 encoding, then PHP should output the header: header(“Content-Type: text/html; charset=gb2312”), and add e08867e58bfd8487d5b8b0f3561d1517, the encoding format of all files is ANSI, you can open it with Notepad, save as, select the encoding as ANSI, and overwrite the source file.

b. If you want to use utf-8 encoding, then php should output the header: header("Content-Type: text/html; charset=utf-8"), and add 13c5722654c1a7709eff3eb748a385ba, the encoding format of all files is utf-8. Saving as utf-8 may be a bit troublesome. Generally, utf-8 files will have BOM at the beginning. If you use session, there will be problems. You can use editplus to save. In editplus, go to Tools->Parameter Selection->File-> UTF-8 signature, select Always delete, then save to remove the BOM information.

Mysql and PDO Chinese garbled code:

Add after the new PDO connection:

$pdo->query('set names utf8;');

         

php Chinese garbled code:

a . If you want to use gb2312 encoding, then PHP should output the header: header(“Content-Type: text/html; charset=gb2312”), and add 0c718c115c073d58df110d25b374ed7c, the encoding format of all files is ANSI, you can open it with Notepad, save as, select the encoding as ANSI, and overwrite the source file.

b. If you want to use utf-8 encoding, then php should output the header: header("Content-Type: text/html; charset=utf-8"), and add 13c5722654c1a7709eff3eb748a385ba, the encoding format of all files is utf-8. Saving as utf-8 may be a bit troublesome. Generally, utf-8 files will have BOM at the beginning. If you use session, there will be problems. You can use editplus to save. In editplus, go to Tools->Parameter Selection->File-> UTF-8 signature, select Always delete, then save to remove the BOM information.

Mysql and PDO Chinese garbled characters:

Add after the new PDO connection:

$pdo->query('set names utf8;');

Related recommendations:

Perfectly solve the problem of PHP garbled characters How to solve the garbled code in high-concurrency php web pages with php? How to solve the cross-domain problem with php


The above is the detailed content of PHP plus xmapp Chinese garbled code. 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