PHP读取数据库中文显示问号

obe007 obe007 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
页面编码改成UTF-8了 数据库里的表编码改了 字段编码也改了 就是不知道为什么还是显示???问号



<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>综合素质</title>
<link rel="stylesheet" type="text/css" href="index.css">
<script src="jquery-2.1.3.js"></script>
<script src="index.js"></script>
</head>

<?PHP
$con = mysql_connect("localhost","root","");
mysql_select_db("radom100",$con);
session_start();
$sql = "select * from user2";
$result = mysql_query($sql);
$arr = array();
while($row = mysql_fetch_array($result)){
$arr[] = $row;
}

$txt = '';

foreach($arr as $key){
$txt = '<tr>
<td width="4%" style=" text-align:center;">'.$key['id'].'</td>
<td width="77%">'.$key['choice'].'</td>
<td width="19%">'.$key['select'].'</td>
</tr>';
}



?>

<body>
<table width="80%" align="center" border="1px" cellpadding="10" cellspacing="2">
<tr>
<th style="font-family: 楷体; font-size: 20px;">编号</th>
<th style="font-family:楷体; font-size: 40px;">题目</th>
<th width="19%" style="font-family:楷体; font-size:28px;">答案</th>
</tr>
<?PHP echo $txt; ?>
<tr>
<td width="4%"> </td>
<td width="77%"> </td>
<td width="19%"> </td>
</tr>
</table>




</body>
</html>
...全文

相关推荐

评论 6
收藏 已收藏
分享
返回顶部
obe007
基础编程 21,889 成员 140,329 内容