1.数据库编码
ALTER DATABASE 'test' DEFAULT CHARACTER SET utf8 COLLATE utf8_bin2.表category的编码该为utf8
ALTER TABLE 'category' DEFAULT CHARACTER SET utf8 COLLATE utf8_bin3.修改字段的编码:
ALTER TABLE 'test' CHANGE 'dd' 'dd' VARCHAR( 45 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL4.在连接数据库的语句中mysql_connect('localhost','user','password'); mysql_select_db('my_db'); mysql_query("set names utf8;"); //select 数据库之后加多这一句5.PHP页面开始第一句
header("content-type:text/html; charset=utf-8");