Skip to content

Uri: withUserInfo Example

Terry L edited this page Jun 20, 2020 · 4 revisions
Clone this wiki locally


withUserInfo($user, $password)

Return an instance with the specified user information.

  • param string user * The user name to use for authority.
  • param string|null password = null The password associated with $user.
  • return static


echo $uri->getUserInfo();
// Outputs: terry:1234

$url = $uri->withUserInfo('jack', '5678');

echo $uri->getUserInfo();
// Outputs: jack:5678