<?php
$file = fopen("liuyan.txt", "r") or exit("Unable to open file!");
//Output a line of the file until the end is reached
while(!feof($file))
{
echo fgets($file);
}
fclose($file);
?>为什么输出来的内容是乱码,要怎么解决呀,急啊?
$file = fopen("liuyan.txt", "r") or exit("Unable to open file!");
//Output a line of the file until the end is reached
while(!feof($file))
{
echo fgets($file);
}
fclose($file);
?>为什么输出来的内容是乱码,要怎么解决呀,急啊?
用iconv转码试一下
还是搜别人的帖子吧.
$file = fopen("liuyan.txt", "r") or exit("Unable to open file!");
//Output a line of the file until the end is reached
while(!feof($file)){
$string .= fgets($file);
}
fclose($file);
$chinese = iconv('ISO-8859-1', 'GB2312', $string);
echo $chinese;
?>