嗨,我使用此代码在文件中读取和写入文本。
$d = fopen("chat.txt", "r");
$content=fread($d,filesize('chat.txt'));
$bn=explode('||',$content);
foreach($bn as $bn)
echo $bn.'<br>';
和
$d = fopen("chat.txt", "a");
$c=$_GET['c'];
if($c=='') die();
fwrite($d,$c.'||');
fclose($d);
但在 =ie only= utf-8 字符显示“?” 或者 ”[]” 。我的编码 Utf-8 没有 BOM,我用这个
header('Content-type: text/html; charset=UTF-8');
和这个 :
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
我在 php.ini 中的默认编码是 utf-8 但还显示?. 我在文件中看到了 chat.txt 文件和字符,但是当使用 ie 保存在文件中并且在页面中显示时显示“?” 而不是对。