array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ru', ), '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); ?>
(PHP 8 >= 8.5.0)
Uri\Rfc3986\Uri::withUserInfo — Modify the userinfo component
Creates a new URI and modifies its userinfo component.
userinfoThe modified Uri\Rfc3986\Uri instance.
If the resulting URI is invalid, a Uri\InvalidUriException is thrown.
Пример #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();
?>Результат выполнения приведённого примера:
userinfo