使用下面的代码查询 mysql db 后,我生成了一个 html 文件:
$myFile = "page.htm";
$fh = fopen($myFile, 'w') 或 die("无法打开文件"); fwrite($fh, $row['text']); fclose($fh);
在 msql db 上,文本使用 utf8_general_ci 进行编码。但我需要将它包含在一个 php 网页中,如下所示:
<?include('page.htm');?>
请记住,php 网页在标题上使用 utf8 字符集:
<meta http-equiv="content-type" content="text/html; charset=utf8" />
现在,如果我在 db 上写一些带有重音(è àì)或引号字符的字母,然后我直接打开 page.htm 并在 db 上我看到它看起来一切正常,但是当我在 php 页面上查看它时我看到问号 � 字符而不是我最初想要的字符。为什么?!提前致谢!