« Uri\WhatWg\Url::equals
Uri\WhatWg\Url::getFragment »

Uri\WhatWg\Url::getAsciiHost

(PHP 8 >= 8.5.0)

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

説明

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

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

パラメータ

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

戻り値

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

例

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

<?php

$url = new \Uri\WhatWg\Url("https://täst.example.com");

echo $url->getAsciiHost();

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

xn--tst-qla.example.com

参考

関連キーワード:
ホスト   コンポーネント   WhatWg   getAsciiHost   Unicode   example   正規化   equals   getFragment   Punycode   基本的   https   täst   参考   getUnicodeHost   withHost   getRawHost   getHost
関連する関数・ページ:
uri-whatwg-url.getunicodehost   uri-whatwg-url.withhost   uri-rfc3986-uri.gethost   uri-rfc3986-uri.getrawhost   class.uri-whatwg-url   uri-rfc3986-uri.withhost