Uri\WhatWg\Url::resolve
(PHP 8 >= 8.5.0)
Resolve a URL with the current object as the base URL
Description
Resolves a valid URL string - which may potentially be a relative-URL string - with the current object as the base URL.
Parameters
uriA valid URL string (e.g.
/fooor (e.g.https://example.com/foo) to apply on the current object.softErrorsAn Array to pass a list of
Uri\WhatWg\UrlValidationErrorinstances by reference to provide extended information about the soft errors triggered during reference resolution.
Return Values
A new Uri\WhatWg\Url instance.
Errors/Exceptions InvalidUrlException
Examples
Uri\WhatWg\Url::resolve basic example
<?php
$url = new \Uri\WhatWg\Url("https://example.com");
$url = $url->resolve("/foo");
echo $url->toAsciiString();
?>The above example will output:
https://example.com/fooSee Also
Uri\WhatWg\Url::__constructUri\WhatWg\Url::parseUri\Rfc3986\Uri::resolve