+
95
-

回答

php与python都要改变一下:具体修改后代码如下:

点击查看

python

import json

data = {"text": "Hello, 你好 is a test message!"}
key = "121323#1231"

# 使用 ensure_ascii=False 避免 Unicode 转义
json_str = json.dumps(data,separators=(",", ":"),sort_keys=False) + key
print(json_str)

php

<?php
$data = ["text" => "Hello, 你好 is a test message!"]; 
$key = "121323#1231"; // 使用 JSON_UNESCAPED_UNICODE 避免 Unicode 转义
$json_str = json_encode($data,JSON_UNESCAPED_SLASHES) . $key;
echo $json_str; 
?>

网友回复

我知道答案,我要回答