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

PHP plus xmapp Chinese garbled code

不言
Release: 2023-03-23 13:22:01
Original
1264 people have browsed it

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 , 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 , 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;');
Copy after login
Copy after login

         

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 , 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 , 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;');
Copy after login
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template