当然首先要理清楚到底是web服务端造成,php造成的,还是数据库造成的。
需要在头文件里UTF-8
<head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <?php $con = @mysql_connect("localhost","Thh","920920thh"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("smstran_db", $con); $result = mysql_query("SELECT * FROM Messages ORDER BY Id DESC LIMIT 10"); while($row = mysql_fetch_array($result)) { echo "号码:" . $row['FromNumber'] . " 信息内容: " . $row['MessageBody'] . " 收件时间" . $row['Time']; echo "<br />"; } mysql_close($con); ?>