<html>
<head><title>my php</title></head>
<body>
<?php
header('Content-type: text/html; charset=utf-8');$myone="你好这是我第一个字符串连接";
$mytwo="的php程序文件";
$mythree="换行作用\n";
echo $myone.$mytwo.$mythree;
?>
</body>
</html>
这段程序运行的时候为什么显示乱码
<head><title>my php</title></head>
<body>
<?php
header('Content-type: text/html; charset=utf-8');$myone="你好这是我第一个字符串连接";
$mytwo="的php程序文件";
$mythree="换行作用\n";
echo $myone.$mytwo.$mythree;
?>
</body>
</html>
这段程序运行的时候为什么显示乱码
header('Content-type: text/html; charset=utf-8');
?><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>my php</title></head>
<body>
<?php$myone="你好这是我第一个字符串连接";
$mytwo="的php程序文件";
$mythree="换行作用\n";
echo $myone.$mytwo.$mythree;
?>
</body>
</html>
用eclipse,dw什么的打开文件查看页面编码是否是gbk/gb2312.如果是的话另存为utf-8编码的。
<head><title>my php</title></head>
<body>
<?php
header('Content-type: text/html; charset=gb2312');$myone="你好这是我第一个字符串连接";
$mytwo="的php程序文件";
$mythree="换行作用\n";
echo $myone.$mytwo.$mythree;
?>
</body>
</html>
ff检测通过 反正不是gb2312 就是utf-8