Uri\WhatWg\Url::withHost
Modify the host component
説明
public static Uri\WhatWg\Url::withHost(stringnull $host)
Creates a new URL and modifies its host component.
パラメータ
-
host
-
New host component.
戻り値
The modified Uri\WhatWg\Url instance.
エラー / 例外
If the resulting URL is invalid, a Uri\WhatWg\InvalidUrlException is thrown.
例
例1 Uri\WhatWg\Url::withHost basic example
<?php
$url = new \Uri\WhatWg\Url("https://example.com");
$url = $url->withHost("example.net");
echo $url->getAsciiHost();
?>
参考
- Uri\WhatWg\Url::getAsciiHost
- Uri\WhatWg\Url::getUnicodeHost
- Uri\Rfc3986\Uri::withHost