mysqli->query("set names utf8");数据库中,设置了一些"/> mysqli->query("set names utf8");数据库中,设置了一些">

mysql安插中文乱码

WBOY
Release: 2016-06-13 11:33:35
Original
905 people have browsed it

mysql插入中文乱码
php文件里设置了网页编码为utf-8
header("Content-type:text/html; charset=utf-8"); 

插入数据库前设置了传递给数据库的编码为utf-8
$this->mysqli->query("set names utf8");

数据库中,设置了一些字符集有关的变量
查询show variables like 'char%';后结果为


查询show variables like 'collation_%';后结果为


我用的WampServer,修改mysql配置文件my.ini,在[client]节点下添加default-character-set=utf8 ,在[mysqld]节点下添加character_set_server=utf8,然后重启musql服务


但是传到数据库里,中文字符都变成了问号。。请问应该如何设置才能解决乱码?

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