在 URL 中使用重复参数 [英] Using duplicate parameters in a URL

查看:30
本文介绍了在 URL 中使用重复参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在内部构建 API,并且经常传递具有多个值的参数.

We are building an API in-house and often are passing a parameter with multiple values.

他们使用:mysite.com?id=1&id=2&id=3

They use: mysite.com?id=1&id=2&id=3

而不是:mysite.com?id=1,2,3

Instead of: mysite.com?id=1,2,3

我喜欢第二种方法,但我很好奇第一种方法是否真的不正确?

I favor the second approach but I was curious if it was actually incorrect to do the first?

推荐答案

我不是 HTTP 专家,但据我了解,关于多个值的 URL 查询部分没有明确的标准,通常最多处理解析查询字符串请求的 CGI.

I'm not an HTTP guru, but from what I understand there's not a definitive standard on the query part of the URL regarding multiple values, it's typically up to the CGI that handles the request to parse the query string.

RFC 1738 第 3.3 节提到了 searchpart 并且它应该在? 但似乎没有详细说明其格式.

RFC 1738 section 3.3 mentions a searchpart and that it should go after the ? but doesn't seem to elaborate on its format.

http://:/?

这篇关于在 URL 中使用重复参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆