update page now

Uri\WhatWg\Url::resolve

(PHP 8 >= 8.5.0)

Uri\WhatWg\Url::resolveResolve a URL with the current object as the base URL

Beschreibung

public Uri\WhatWg\Url::resolve(string $uri, array &$softErrors = null): static

Resolves a valid URL string - which may potentially be a relative-URL string - with the current object as the base URL.

Parameter-Liste

uri
A valid URL string (e.g. /foo or (e.g. https://example.com/foo) to apply on the current object.
softErrors
An Array to pass a list of Uri\WhatWg\UrlValidationError instances by reference to provide extended information about the soft errors triggered during reference resolution.

Rückgabewerte

A new Uri\WhatWg\Url instance.

Fehler/Exceptions

If the resulting URL is invalid, a Uri\WhatWg\InvalidUrlException is thrown.

Beispiele

Beispiel #1 Uri\WhatWg\Url::resolve() basic example

<?php
$url
= new \Uri\WhatWg\Url("https://example.com");
$url = $url->resolve("/foo");

echo
$url->toAsciiString();
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

https://example.com/foo

Siehe auch

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top