从redis读取的数据,这个数据是json发现nickname是乱码的
$data:
Array
(
[0] => {"userid":270,"nickname":"erjiankuan"}
[1] => {"userid":114,"nickname":"��ͨ���"}
[2] => {"userid":250,"nickname":"������"}
[3] => {"userid":209,"nickname":"dnkldnuin"}
[4] => {"userid":229,"nickname":"�½����"}
[5] => {"userid":115,"nickname":"��������"}
[6] => {"userid":237,"nickname":"÷���"}
[7] => {"userid":234,"nickname":"����876wxy"}
[8] => {"userid":270,"nickname":"�����"}
[9] => {"userid":228,"nickname":"111111mm"}
)
转码:
foreach($data as $k=>$v){
$data[$k] = json_decode(iconv('gbk','utf-8',$v),true);
}
Array
(
[0] => Array
(
[userid] => 270
[nickname] => erjiankuan
)
[1] => Array
(
[userid] => 114
[nickname] => 亨通光电
)
[2] => Array
(
[userid] => 250
[nickname] => 锁俊炎
)
[3] => Array
(
[userid] => 209
[nickname] => dnkldnuin
)
[4] => Array
(
[userid] => 229
[nickname] => 新疆天池
)
[5] => Array
(
[userid] => 115
[nickname] => 海上世界
)
[6] => Array
(
[userid] => 237
[nickname] => 梅园五村
)
[7] => Array
(
[userid] => 234
[nickname] => 星尚876wxy
)
[8] => Array
(
[userid] => 270
[nickname] => 撒振飞
)
[9] => Array
(
[userid] => 228
[nickname] => 111111mm
)
)
成功!!!