Home > Backend Development > PHP Tutorial > 设置字符集后如何还乱码

设置字符集后如何还乱码

WBOY
Release: 2016-06-13 12:33:29
Original
774 people have browsed it

设置字符集后怎么还乱码
$load_list 是一个二维数组,将其中的user_name值取出前两个字符,后面用星号代替,但是设置字符集后还是有乱码,但是中文是要显示前两个字符,后面用星号表示
foreach($load_list as $k=>&$v){

$temp=&$v['user_name'];
//判断是否有中文
 if (!preg_match('/^([\x81-\xfe][\x40-\xfe]){0,2}$/',$temp)){
$len=mb_strlen($temp,'utf-8');
}else{
$len=strlen($temp);
}
 for($k=0;$k if($k>1){
  $temp[$k]='*';
}

设置字符集后还乱码
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template