douyuefu1372 2019-06-12 12:54
浏览 76
已采纳

在API中使用时$ request-> get('foo')会做什么?

Beginner question, ive search around the internet but it does not explain it very well. What does $request->get('foo') do when using in combination in API request.

  @Get("/event/{eventId}/eventAttendee")
      *
      * @View(serializerGroups={"Default"})
      * @ApiDoc(
      *  output= {
       *      "class" = "array<KCM\ApiBundle\Contract\EventAttendee>",
       *      "groups" = {"Default"}
       *  },
       *  requirements={
       *    {
       *      "name"="eventId",
       *      "dataType"="string",
       *      "requirement"="(\w|-)+",
       *      "description"="Event ID"
       *    },
       *    {
       *      "name"="filter",
       *      "dataType"="string",
       *      "requirement"="(\w|-)+",
       *      "description"="Value to search for within fields"
       *    }
       *  }
       * )
       *     

public function getEventAttendeesByFilterAction (Reqest $request, $eventID)

 $filter = $request->get('filter')

trying to find out what does $filter do when combined with this controller. I put the annotations above as well.

  • 写回答

1条回答 默认 最新

  • doujumiao5024 2019-06-12 13:00
    关注

    $request->get() retrieve the variable value given in either a GET or a POST request. In your case it retrieves the filter variable value.

    You can read this documentation which talk about HTTP requests : https://symfony.com/doc/current/introduction/http_fundamentals.html

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记