/** * 由于php的json扩展自带的函数json_encode会将汉字转换成unicode码 * 所以我们在这里用自定义的json_encode,这个函数不会将汉字转换为unicode码 */ public function customJsonEncode($a = false) { if (is_null($a)) return 'null'; if ($a === false) return 'false'; if ($a === true) return 'true'; if (i
json_encode()是PHP中将数组转换成JSON格式的函数,因为各种原因只要是中文就会乱码= = 找到了这么一个函数替代了原有的json_encode(),能很好地输出中文~ function ch_json_encode($data) { function ch_urlencode($data) { if (is_array($data) || is_object($data)) { foreach ($data as $k => $v) { if (is_scalar($v)) {