class Request (View source)

The Request class.

Methods

static string
page()

Return the URL of the currently requested page.

static string
query(string $key)

Return a sanitized value of a query string parameter or any empty string, if that parameter doesn't exist.

static string
post(string $key)

Return value by key in the $_POST array or any empty string, if that key doesn't exist.

Details

static string page()

Return the URL of the currently requested page.

Return Value

string The requested URL

static string query(string $key)

Return a sanitized value of a query string parameter or any empty string, if that parameter doesn't exist.

Note: Since this method always returns a string, it should not be used to test whether a parameter exists in the query string, because a non-existing parameter and an empty string as a parameter's value will return the same.

Parameters

string $key

Return Value

string The value for the requested query key

static string post(string $key)

Return value by key in the $_POST array or any empty string, if that key doesn't exist.

Note: Since this method always returns a string, it should not be used to test whether a key exists in $_POST.

Parameters

string $key

Return Value

string The value for the requested key