开发语言:php
post数组数据:
$post = [
"order_key" => [
"order_number_type" => 1,
"mchid" => "1646111***",
"out_trade_no" => "20230721101459***"
],
"logistics_type" => 2,
"delivery_mode" => 1,
"shipping_list" => [
[
"item_desc" => "玉米饭(1)"
]
],
"upload_time" => "2023-07-21T10:35:43.575+08:00",
"payer" => [
"openid" => "o1hyC66giLDx****2frG9n9-****"
]
];
发起POST请求:
$res = Http::withHeaders(['Content-Type' => 'application/json;charset=UTF-8'])->post($url, $post);
返回状态正常,已经发货成功,但是在微信客户端服务通知中商品信息乱码,大佬么是怎么解决的?
用UTF8编码
$param = json_encode($param,JSON_UNESCAPED_UNICODE);
$result = post_url_content($url, $param);
json化的时候转义了,用这个
$str = json_encode($a, JSON_UNESCAPED_UNICODE);
python怎么解决
不支持php,因为php不支持utf-8编码,需要用java golang等语言