Home >php教程 >php手册 >Mysql和网页显示乱码解决方法集锦

Mysql和网页显示乱码解决方法集锦

WBOY
WBOYOriginal
2016-06-13 12:29:581094browse

将数据插入到php?name=%CA%FD%BE%DD%BF%E2" onclick="tagshow(event)" class="t_tag">数据库的时候显示乱码及从php?name=%CA%FD%BE%DD%BF%E2" onclick="tagshow(event)" class="t_tag">数据库读取出来的数据在网页上显示为乱码的问题,其实就是做到php?name=%CA%FD%BE%DD%BF%E2" onclick="tagshow(event)" class="t_tag">数据库编码,网页编码及表的编码一致)!GBK2312与下同理

(1)设置数据库编码,  为了与国际接轨,一般都设置成utf-8
(2)数据表的设置,也设置成utf-8
(3)把你的网页编码也设置成utf-8,打开Dreamweaver,(修改)--(页面属性)
(4)在你的PHP文件的第一行加上 header("Content-Type: text/html; charset=utf-8");
(5)在对数据进行操作之前应该先进行mysql_query('set names utf8');操作,然后再执行对数据的查询,更新,插入等

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