Home > Backend Development > PHP Tutorial > 为什么写入mysql的有中文字的要么写不出来 要么乱码啊

为什么写入mysql的有中文字的要么写不出来 要么乱码啊

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:44:24
Original
1204 people have browsed it

![这是写入mysql的乱码

回复内容:

![这是写入mysql的乱码

1.mysql 数据库的默认编码不是utf8
2.在代码中初始化数据库连接的时候未指定编码为utf8

我也遇到过 , 是因为乱码的原因, 后来改了就好了,可以在建数据库时候指定编码

看看你的DB编码设置
为什么写入mysql的有中文字的要么写不出来 要么乱码啊
看看你的table编码设置
为什么写入mysql的有中文字的要么写不出来 要么乱码啊
看看你的column编码设置
为什么写入mysql的有中文字的要么写不出来 要么乱码啊

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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template