Uri\Rfc3986\Uri::resolve
PHP function
Edit on GitHub ✎
(PHP 8 >= 8.5.0)
Resolve a URI with the current object as the base URL
Description
Uri\Rfc3986\Uri::resolve(string $uri): static
Resolves a URI - which may potentially be a relative reference - with the current object as the base URL.
Parameters
uriA URI to apply on the current object.
Return Values
A new Uri\Rfc3986\Uri instance.
Errors/Exceptions InvalidUriException
Examples
Uri\Rfc3986\Uri::resolve basic example
php
<?php
$uri = new \Uri\Rfc3986\Uri("https://example.com");
$uri = $uri->resolve("/foo");
echo $uri->toRawString();
?>The above example will output:
output
https://example.com/fooSee Also
Uri\Rfc3986\Uri::__constructUri\Rfc3986\Uri::parseUri\WhatWg\Url::resolve