From a2aaf6a7b987e710e55d8f5b96b615f3b0c05638 Mon Sep 17 00:00:00 2001 From: wuyongyuan <270458160@qq.com> Date: Thu, 14 Oct 2021 20:29:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9HttpBuildStringQuery=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- map.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/map.go b/map.go index 6343157..435f465 100644 --- a/map.go +++ b/map.go @@ -2,6 +2,7 @@ package helper import ( "errors" + "net/url" "sort" "strings" ) @@ -121,7 +122,7 @@ func HttpBuildQuery(data map[string]string) string { } /** - * 对map进行拼接 + * 对map字典按照顺序进行拼接,并且把每个value进行类urlencode * @param data map[string]string * @2021/10/14 * @wyy @@ -139,7 +140,7 @@ func HttpBuildStringQuery(data map[string]string) string { for _, value := range keySlice { if value != "" && data[value] != "" { - query += StringJoin(value, "=", data[value], "&") + query += StringJoin(value, "=", url.QueryEscape(data[value]), "&") } }