代码:
- header("Content-Type: text/html; charset=utf8");
- mysql_query("set names utf8");
其中的“set names utf8”,至少在我今天所测的时候是不可以写成其它的格式。以下格式,我测试的时候对linux环境下的数据正确读取无效果。
- mysql_query("set names as utf8");//error
- mysql_query("set name utf-8");//error
前提文件的编码也得统一成utf8.
转载于:https://blog.51cto.com/hanluner03/629327