FOSRestBundle:RequestParam 和 QueryParam 的区别
FOSRestBundle : Difference between RequestParam and QueryParam
我不明白 @QueryParam 和 @RequestParam 注释与 FOSRestBundle 之间的区别(示例:https://symfony.com/doc/master/bundles/FOSRestBundle/param_fetcher_listener.html)。
你能知道我必须使用哪一个来声明我的 API 参数吗?
取决于您希望通过 API 端点实现的目标。基本上 QueryParam
represents a parameter that must be present in GET data (so we're talking about query string parameters) while RequestParam
表示必须存在于 POST 或 PUT 数据中的参数(这意味着正文中的参数请求)。
我不明白 @QueryParam 和 @RequestParam 注释与 FOSRestBundle 之间的区别(示例:https://symfony.com/doc/master/bundles/FOSRestBundle/param_fetcher_listener.html)。
你能知道我必须使用哪一个来声明我的 API 参数吗?
取决于您希望通过 API 端点实现的目标。基本上 QueryParam
represents a parameter that must be present in GET data (so we're talking about query string parameters) while RequestParam
表示必须存在于 POST 或 PUT 数据中的参数(这意味着正文中的参数请求)。