原文:https://www.jianshu.com/p/90917829460a

use think\Request; class Name { $request = Request::instance(); $method = $request->method();//獲取上傳方式 $request->param();//獲取所有參數,最全 $get = $request->get();獲取get上傳的內容 $post = $request->post();獲取post上傳的內容 $request->file('file')獲取文件 }
或

use think\Controller; class Name { $method = $this->request->method();//獲取上傳方式 $this->request->param();//獲取所有參數,最全 $get = $this->request->get();獲取get上傳的內容 $post = $this->request->post();獲取post上傳的內容 $this->request->file('file')獲取文件 }