Get the URL that initiated the current request, including URL segments and page numbers
This should be the same as
$page->url
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->url();
$url = $sanitizer->entities($url); // entity encode for output
echo "You accessed this page at: $url";
Usage
// basic usage
$string = $input->url();
// usage with all arguments
$string = $input->url($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