PHP返回mysql数据库中文字符出现乱码问题之解决方案
在查询前插入:mysql_query("set names 'utf8'"); for example:
mysql_connect("localhost","root","123456"); 
mysql_select_db("test"); 
mysql_query("set names 'utf8'"); 
$result=mysql_query("select * from info"); 
echo "<table border=1>"; 
echo "<tr><td>name</td><td>id</td><td>tel</td></tr>"; 
while ($arr=mysql_fetch_array($result)) { 
echo "<tr><td>".$arr[0]."</td>"; 
echo "<td>".$arr[1]."</td>";
echo "<td>".$arr[2]."</td></tr>"; 
} 
echo "</table>"; 
mysql_close();

浙公网安备 33010602011771号