Home  >  Article  >  Backend Development  >  utf-8-PHP 乱码的顽症--部分乱码

utf-8-PHP 乱码的顽症--部分乱码

WBOY
WBOYOriginal
2016-06-02 11:29:051730browse

utf-8php乱码

先上代码

header("content-type:text/html;charset=utf-8");

$filep="text/ok.txt";
if(file_exists($filep))
{
$fop=fopen($filep,"r");
$k=0;
while(!feof($fop)&&$k {
$str=fread($fop,"200");
echo "

".str_ireplace("\r\n","
",$str)."

";
$k=$k+200;
}
}

else
{
echo "failed open file";
}
clearstatcache();
?>
输出是这样的,(我的ok.txt文本中内容是--本文--两个字的不断重复。)
上图。
图片说明

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn