代碼:
- 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.