sw-fw-less
  • sw-fw-less
  • get started
    • Installation
    • Directory
    • Config
    • Quick Start
  • MVC
    • Router
    • Middleware
    • Request
    • Param Validator
    • Model
    • Response
  • Database
    • MySQL
    • Redis
    • Elasticsearch
  • Storage
    • General
    • File
    • Qiniu
    • Alioss
  • OTHER
    • Pagination
    • Helper
    • Error Handler
    • AMQP-0-9-1
    • Events
  • Deployment
    • Nginx
    • Docker
  • APPENDIX
    • Development Rules
Powered by GitBook
On this page
  • Context Info
  • Example

Was this helpful?

  1. MVC

Request

The request object can be accessed in your router handler.

Context Info

  • Swoole Request

  • Get Parameter

  • Post Parameter

  • File Parameter

  • Request Parameter(Get、Post、File parameter)

  • All Request Parameters

  • Header

  • Server Environment Variable

  • Request Method

  • Request URI

  • Query String

  • HTTP Body

Example

// Fetch Swoole Request
$this->getRequest()->getSwRequest();

// Fetch Get Parameter
$this->getRequest()->get('foo');

// Fetch Post Parameter
$this->getRequest()->post('foo');

// Fetch File Parameter
$this->getRequest()->file('foo');

// Fetch Request Parameter
$this->getRequest()->param('foo');

// Fetch All Request Parameters
$this->getRequest()->all();

// Fetch Header
$this->getRequest()->header('foo');

// Fetch Server Environment Variable
$this->getRequest()->server('foo');

// Fetch Request Method
$this->getRequest()->method();

// Fetch Request URI
$this->getRequest()->uri();

// Fetch Query String
$this->getRequest()->queryString();

// Fetch HTTP Body
$this->getRequest()->body();
PreviousMiddlewareNextParam Validator

Last updated 6 years ago

Was this helpful?