Go语言 将多维GET查询字符串加载到[]string中

xoefb8l8  于 2023-11-14  发布在  Go
关注(0)|答案(1)|浏览(89)
?select[0]=id,client_id,timout&select[1]=more,fields&data=test

字符串
如何将此查询字符串加载到[]字符串中?

[]string{
    "id,client_id,timout",
    "more,fields",
}

iszxjhcz

iszxjhcz1#

The standard way to pass a list of values as URL parameters is to repeat them。如果使用以下语法:

?select=id,client_id,timout&select=more,fields&data=test

字符串
URL.Query()将返回a Values map[string][]string that will already contain under select

[]string{"id,client_id,timout", "more,fields"}

相关问题