控制器类:EasySwoole\Http\AbstractInterface\Controller;
继承了这个类便获取了控制器的功能,里面有我们需要的内置对象。
请求对象:$this->request();
$this->request()->getRequestParam([string]); 获取POST或GET提交的参数
$this->request()->getParsedBody();获取post内容
响应对象:$this->response();
$this->response()->write(string);
$this->response()->withHeader();设置响应头
$this->writeJson($statusCode,$result,$msg);向客户端发送json字符串。
$result直接为数组。
$this->response()->redirect(url);请求重定向
$this->response)->setCookie();