Uri\WhatWg\Url::withPassword
Modify the password component
説明
public static Uri\WhatWg\Url::withPassword(#[\SensitiveParameter]stringnull $password)
Creates a new URL and modifies its password component.
パラメータ
-
password
-
New password component.
戻り値
The modified Uri\WhatWg\Url instance.
エラー / 例外
If the resulting URL is invalid, a Uri\WhatWg\InvalidUrlException is thrown.
例
例1 Uri\WhatWg\Url::withPassword basic example
<?php
$url = new \Uri\WhatWg\Url("https://user:password@example.com");
$url = $url->withPassword("pass");
echo $url->getPassword();
?>
参考
- Uri\WhatWg\Url::getPassword
- Uri\WhatWg\Url::getUsername
- Uri\Rfc3986\Uri::withUserInfo