mirror of https://github.com/flightphp/core
parent
dc4e075f3f
commit
05edb161e7
@ -0,0 +1,30 @@
|
|||||||
|
Flight encapsulates the HTTP request into a single object, which can be accessed by doing:
|
||||||
|
|
||||||
|
$request = Flight::request();
|
||||||
|
|
||||||
|
The request object provides the following properties:
|
||||||
|
|
||||||
|
url - The URL being requested
|
||||||
|
base - The parent subdirectory of the URL
|
||||||
|
method - The request method (GET, POST, PUT, DELETE)
|
||||||
|
referrer - The referrer URL
|
||||||
|
ip - IP address of the client
|
||||||
|
ajax - Whether the request is an AJAX request
|
||||||
|
scheme - The server protocol (http, https)
|
||||||
|
user_agent - Browser information
|
||||||
|
body - Raw data from the request body
|
||||||
|
type - The content type
|
||||||
|
length - The content length
|
||||||
|
query - Query string parameters
|
||||||
|
data - Post parameters
|
||||||
|
cookies - Cookie parameters
|
||||||
|
files - Uploaded files
|
||||||
|
|
||||||
|
You can access the `query`, `data`, `cookies`, and `files` properties as arrays or objects.
|
||||||
|
So, to get a query string parameter, you can do:
|
||||||
|
|
||||||
|
$id = Flight::request()->query['id'];
|
||||||
|
|
||||||
|
Or you can do:
|
||||||
|
|
||||||
|
$id = Flight::request()->query->id;
|
Loading…
Reference in new issue