array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'uri-rfc3986-uri.withuserinfo.php', 1 => 'Uri\\Rfc3986\\Uri::withUserInfo', 2 => 'Modify the userinfo component', ), 'up' => array ( 0 => 'class.uri-rfc3986-uri.php', 1 => 'Uri\\Rfc3986\\Uri', ), 'prev' => array ( 0 => 'uri-rfc3986-uri.withscheme.php', 1 => 'Uri\\Rfc3986\\Uri::withScheme', ), 'next' => array ( 0 => 'class.uri-whatwg-url.php', 1 => 'Uri\\WhatWg\\Url', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/uri/uri/rfc3986/uri/withuserinfo.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

Uri\Rfc3986\Uri::withUserInfo

(PHP 8 >= 8.5.0)

Uri\Rfc3986\Uri::withUserInfoModify the userinfo component

Beschreibung

public Uri\Rfc3986\Uri::withUserInfo(#[\SensitiveParameter] ?string $userinfo): static

Creates a new URI and modifies its userinfo component.

Parameter-Liste

userinfo
New userinfo component.

Rückgabewerte

The modified Uri\Rfc3986\Uri instance.

Fehler/Exceptions

If the resulting URI is invalid, a Uri\InvalidUriException is thrown.

Beispiele

Beispiel #1 Uri\Rfc3986\Uri::withUserInfo() basic example

<?php
$uri
= new \Uri\Rfc3986\Uri("https://user:password@example.com");
$uri = $uri->withUserInfo("userinfo");

echo
$uri->getUserInfo();
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

userinfo

Siehe auch