【发布时间】:2012-05-26 02:14:16
【问题描述】:
您好,我使用此代码在文件中读取和写入文本。
$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 保存在文件中并且在页面中显示时显示“?”而不是正确的。
【问题讨论】:
-
For each ($bn as $bn) 覆盖 $bn,所以它只会像 heigharcy 一样执行它
-
把 bn 改成 bn1 但没有区别