- ⌂ request
- Methods
\io_comand_web\request
A request
object is used to access HTTP (and HTTPS) GET, POST, COOKIE values, as well as SERVER environment variables.
It essentially provides more controlled methods to access PHP's standard super globals:
- $_GET
- $_POST
- $_REQUEST
- $_FILES
- $_COOKIE
- $_SERVER
Example
// create a new request object to access HTTP info
$request = new \io_comand_web\request();
// check a server environment variable
$uri = $request->server('REQUEST_URI');
// check a cookie value
$sid = $request->cookie('session_id');
// access a URL query string parameter
$action = $request->get('action');
// access a POST parameter
$name = $request->post('name');
// access files uploaded through a form post
$filename = $request->filename('upload');
$filedata = $request->file('upload');