Uri\WhatWg\Url::getAsciiHost
PHP Manual
PHP Manual»Uri\WhatWg\Url»Uri\WhatWg\Url::getAsciiHost

Uri\WhatWg\Url::getAsciiHost

(PHP 8 >= 8.5.0)

Uri\WhatWg\Url::getAsciiHostRetrieve the host component as an ASCII string

Опис

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

Retrieves the host component as a string using punycode transcription instead of Unicode characters.

Параметри

У цієї функції немає параметрів.

Значення, що повертаються

Returns the host component as an ASCII string if the host component exists, null is returned otherwise.

Приклади

Приклад #1 Uri\WhatWg\Url::getAsciiHost() basic example

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

echo $url->getAsciiHost();
?>

Поданий вище приклад виведе:

example.com

Прогляньте також

To Top