我有这个连接到我的MySQL BD的php文件,BD调用是latin1_swedish_ci
这是我的PHP代码:
<?php
$con = mysql_connect("localhost","root","");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("ttbfb", $con);
$result = mysql_query("SELECT * FROM news");
while($row = mysql_fetch_array($result)) {
echo $row['name'];
}
mysql_close($con);
?>
如何在获得回音之前将$ row ['name']字符串转换为utf8?
答案 0 :(得分:2)