PHP——JSON
$result = [1,2,‘a‘,‘中国‘,‘USA‘]; $res = json_encode($result, JSON_UNESCAPED_UNICODE); // 转为JSON字符串 JSON_UNESCAPED_UNICODE :防止中文乱码 var_dump($res); var_dump(json_decode($res)); // 转为数组
结果:
$result = [1,2,‘a‘,‘中国‘,‘USA‘]; $res = json_encode($result, JSON_UNESCAPED_UNICODE); // 转为JSON字符串 JSON_UNESCAPED_UNICODE :防止中文乱码 var_dump($res); var_dump(json_decode($res)); // 转为数组
结果: