URL::query()

Returns the URL query data.

URL::query(array $lot = []): ?string;

This method returns the URL query data. The parameter added when you get the query data is used to modify each segment of the query.

Example

$url = new URL('http://127.0.0.1?foo=bar');

test($url->query); // Returns `'?foo=bar'`
test($url->query()); // Returns `'?foo=bar'`
test($url->query(['bar' => 'baz', 'foo' => 1])); // Returns `'?bar=baz&foo=1'`

URL::current()

Returns the full URL address along with its query and hash.

URL::query()

Returns the URL query data.