Home >Backend Development >PHP Tutorial >php中输出中文字符乱码解决思路

php中输出中文字符乱码解决思路

WBOY
WBOYOriginal
2016-06-13 11:40:06908browse

php中输出中文字符乱码
问题如下:
$load_list 是一个二维数组,将其中的user_name值取出前两个字符,后面用星号代替,但是遇到中文字符就出现乱码,设置header()函数,也没用,求解决办法,谢谢!
foreach($load_list as $k=>&$v){
 $temp=&$v['user_name'];

 for($i=0,$len=strlen($temp);$i if($i>1){
  $temp[$i]='*';
}
 }
}

截图如下:

foreach乱码
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