Uri\Rfc3986\Uri::getPort
(PHP 8 >= 8.5.0)
Uri\Rfc3986\Uri::getPort — Retrieve the normalized port component
Description
Retrieves the normalized port component.
Parameters
This function has no parameters.
Return Values
Returns the normalized port component as an int if the port component exists, null is returned otherwise.
Examples
Example #1 Uri\Rfc3986\Uri::getPort() basic example
<?php
$uri = new \Uri\Rfc3986\Uri("https://example.com:443");
echo $uri->getPort();
?>The above example will output:
443
See Also
- Uri\Rfc3986\Uri::withPort() - Modify the port component
- Uri\WhatWg\Url::getPort() - Retrieve the port component
来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。
