Home  >  Article  >  Backend Development  >  Solution to Chinese garbled code in php connection to mysql

Solution to Chinese garbled code in php connection to mysql

WBOY
WBOYOriginal
2016-07-25 08:52:19997browse
This article introduces the solution to Chinese garbled characters when PHP connects to MySQL data. Friends in need can refer to it.

Solution to Chinese garbled characters:

1. When creating the database, select utf-8 encoding

2. Select UTF-8 encoding when creating php files

3. Prevent garbled characters during data transmission

mysql_query('set names utf8');

4. Add: to the static page:

Generally, if the above four points are set, there will be basically no problem.



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