Home >Backend Development >PHP Tutorial > PHP插入SQL中文乱码!解决方案

PHP插入SQL中文乱码!解决方案

WBOY
WBOYOriginal
2016-06-13 13:27:531293browse

PHP插入SQL中文乱码!
我要插入的数据是从URL中获取的,编码都是一致的(PHP页面和SQL数据库),都为utf-8

插入数据以后在phpmyadmin中查看那个数据为乱码。

除了中文以外都正常。

------解决方案--------------------
不知道你在写入数据库的时候加上如下的语句没有,最好试一下

mysql_query("set names utf8");//或者是set names gbk/gb2312

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