Get or set the current request object.
public static request ( Gdn_Request $NewRequest = null ) : Gdn_Request | ||
$NewRequest | Gdn_Request | The new request or null to just get the request. |
return | Gdn_Request |
// Load the Gdn request library require_once 'path/to/Gdn/request.php'; // Extract GET parameters $request = Gdn::request(); $id = $request->get('id'); $name = $request->get('name');
// Load the Gdn request library require_once 'path/to/Gdn/request.php'; // Access HTTP headers $request = Gdn::request(); $user_agent = $request->header('User-Agent'); $referrer = $request->header('Referer');In this example, we are using the Gdn request library to access the User-Agent and Referer HTTP headers. The `header()` method is called on the `$request` object to retrieve the values of these headers. Overall, the Gdn request library is a useful tool for handling incoming HTTP requests in PHP applications. It provides a simple and intuitive API for accessing request data, making it a great option for developers who want to streamline their request-handling code.
public static request ( Gdn_Request $NewRequest = null ) : Gdn_Request | ||
$NewRequest | Gdn_Request | The new request or null to just get the request. |
return | Gdn_Request |