Commit bc314265 authored by Euan游根明's avatar Euan游根明

perf: json中文编码

parent a90b6c20
...@@ -232,11 +232,11 @@ class Nacos ...@@ -232,11 +232,11 @@ class Nacos
$path = self::getPath(sys_get_temp_dir(), '/nacos.cache-'.md5(self::$configs['GROUP']).'-'.self::$configs['APP_ENV']); $path = self::getPath(sys_get_temp_dir(), '/nacos.cache-'.md5(self::$configs['GROUP']).'-'.self::$configs['APP_ENV']);
if (!file_exists($path)) { if (!file_exists($path)) {
$data[$key] = $value; $data[$key] = $value;
return file_put_contents($path, json_encode($data)); return file_put_contents($path, json_encode($data,JSON_UNESCAPED_UNICODE));
} }
$data = json_decode(file_get_contents($path), true); $data = json_decode(file_get_contents($path), true);
$data[$key] = $value; $data[$key] = $value;
return file_put_contents($path, json_encode($data)); return file_put_contents($path, json_encode($data,JSON_UNESCAPED_UNICODE));
} }
/** /**
...@@ -298,14 +298,14 @@ class Nacos ...@@ -298,14 +298,14 @@ class Nacos
$logFile = '/nacos-'.self::$configs['GROUP'].'-'.date('Y-m-d').'.log'; $logFile = '/nacos-'.self::$configs['GROUP'].'-'.date('Y-m-d').'.log';
$path = self::getPath(sys_get_temp_dir(),$logFile); $path = self::getPath(sys_get_temp_dir(),$logFile);
if (!is_string($logData)){ if (!is_string($logData)){
$logData = json_encode($logData); $logData = json_encode($logData,JSON_UNESCAPED_UNICODE);
} }
if (!file_exists($path)) { if (!file_exists($path)) {
$data[] = $logData; $data[] = $logData;
return file_put_contents($path, json_encode($data)); return file_put_contents($path, json_encode($data,JSON_UNESCAPED_UNICODE));
} }
$data = json_decode(file_get_contents($path), true); $data = json_decode(file_get_contents($path), true);
$data[] = $logData; $data[] = $logData;
return file_put_contents($path, json_encode($data)); return file_put_contents($path, json_encode($data,JSON_UNESCAPED_UNICODE));
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment