//获取全局的Request/Response对象 $request = Context::mustGet()->getRequest(); $response = Context::mustGet()->getResponse(); //设置返回格式 默认 UTF-8 $response->withContentType('application/json'); //返回JSON格式 $response->withData($arr); //$arr为数组 自动转换 //对url参数正则验证 @RequestMapping(route="/detail/{id}",params={"id="d+""},method={RequestMethod::GET}) //中间件 //JSON参数的获取