Home > php教程 > php手册 > PHP gbk环境下json_dencode传送来的汉字

PHP gbk环境下json_dencode传送来的汉字

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:35:08
Original
943 people have browsed it

在做一个小项目的时候用得gbk,发现json_encode传过来的汉子不对。搜索出结果。。留下印子不忘记。。欢迎指正

复制代码 代码如下:


function ArrEncode($arr){
foreach($arr as $k=>$v){
if(is_array($v)){
$arr[$k] =ArrEncode($v);
}else{
$arr[$k] = urlencode($v);
}
}
return $arr;
}
在控制器方法里面可以。
$arr = ArrEncode($uns);
echo urldecode(json_encode($arr));

,美国服务器,服务器空间,虚拟主机
Related labels:
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template