json默认转换成utf-8编码或者ascll编码,对于英文、数字无影响,但是中文来说会出现所谓的乱码,解决方案
1.json强制不转码的方法,json_encode($conn,JSON_UNESCAPED_UNICODE);
2.转码后再解码
<?php
$arr=array("name"=>urlencode("中文"));
$result=json_encode($arr);
echo urldecode($result);
?>
3.在php文件中加上header("content-Type: text/html; charset=GBK");