update page now

Uri\Rfc3986\Uri::parse

(PHP 8 >= 8.5.0)

Uri\Rfc3986\Uri::parseParse a URI

説明

public static Uri\Rfc3986\Uri::parse(string $uri, ?Uri\Rfc3986\Uri $baseUrl = null): ?static

Parses a URI.

パラメータ

uri
URI to parse.
baseUrl
When a string is passed, uri is applied on baseUrl, if uri is a relative reference. If either null is passed, or uri is a not a relative reference, then baseUrl doesn't have any effect.

戻り値

Returns a Uri\Rfc3986\Uri instance on success, or null on failure.

例1 Uri\Rfc3986\Uri::parse() basic example

<?php
$uri
= \Uri\Rfc3986\Uri::parse("https://example.com");

if (
$uri !== null) {
echo
"Valid URI: " . $uri->toString();
} else {
echo
"Invalid URI"
}
?>

上の例の出力は以下となります。

Valid URI: https://example.com

参考

add a note

User Contributed Notes

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