Uri\WhatWg\Url::getAsciiHost

(PHP 8 >= 8.5.0)

Uri\WhatWg\Url::getAsciiHostホストコンポーネントを ASCII string として取得する

説明

public Uri\WhatWg\Url::getAsciiHost(): ?string

Unicode 文字ではなく Punycode による変換を使用して、ホストコンポーネントを string として取得します。

パラメータ

この関数にはパラメータはありません。

戻り値

ホストコンポーネントが存在する場合は ASCII string としてホストコンポーネントを返し、存在しない場合は null を返します。

例1 Uri\WhatWg\Url::getAsciiHost() の基本的な例

<?php
$url
= new \Uri\WhatWg\Url("https://example.com");

echo
$url->getAsciiHost();
?>

上の例の出力は以下となります。

example.com

参考