路由

    • route:路由规则
    route参数
    • 显示指定路由后缀:@RequestMapping("index") 或 @RequestMapping(route=”index”)
    • 隐式指定路由后缀: 不使用 @RequestMapping 或者使用 @RequestMapping(), 默认解析方法名为后缀
    • 指定路由参数: @RequestMapping(route=”index/{name}”),Action 方法中可以直接使用 $name 作为方法参数,当路由参数被 [] 包起来则URL传递参数可有可无
    method参数
    1. /**
    2. * @RequestMapping(method={RequestMethod::GET})
    3. */
    4. public function index(){}
    • 限定HTTP方法: @RequestMapping(method={RequestMethod::GET}) 指定路由支持的HTTP方法,默认是支持GET和POST
      • 比如 method={RequestMethod::POST,RequestMethod::PUT} 设置路由支持 POST 和 PUT

    使用说明

    • 通常一个完整的路由path等于 Controller的 + Action的 route
    • 请切记要引入相关的注解类