Get the http URL that initiated the current request, including scheme, URL segments and page numbers
This should be the same as
$page->httpUrl
except that it includes URL segments and page numbers, when present.Note that this does not include query string unless requested (see arguments).
WARNING: if query string requested, it can contain undefined/unsanitized user input. If you use it for output make sure that you entity encode first (by running through
$sanitizer->entities()
for instance).
Example
$url = $input->httpUrl();
$url = $sanitizer->entities($url); // entity encode for output
echo "You accessed this page at: $url";
Usage
// basic usage
$string = $input->httpUrl();
// usage with all arguments
$string = $input->httpUrl($options = []);
Arguments
Name | Type(s) | Description |
---|---|---|
options (optional) | array, bool | Specify
|
Return value
string
See Also
API reference based on ProcessWire core version 3.0.236