访问网址为http://127.0.0.1:8080/data.php出现乱码
php设置如下:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<p>123</p>
<?php
header("Content-type: text/html; charset=gb2312");
echo "连接成功";
?>
</body>
</html>
<meta>与header中的charset设为gb2312。数据库中的排序规则也是gb2312,这样对数据库的操作就不会出现问题。