PHP getservbyport() 函数
定义和用法
getservbyport() 函数返回给定端口和协议的 Internet 服务名。
实例
一个 getservbyport() 的例子:
<?php $intservname = getservbyport(80, "tcp"); echo $intservname; ?>
语法
getservbyport(port, protocol)
参数值
| 参数 | 描述 |
|---|---|
| port | 必需。指定端口号(如 80)。 |
| protocol | 必需。指定协议名(如 "tcp" 或 "udp")。 |
技术细节
| 返回值: | 成功时返回互联网服务名。 |
|---|---|
| PHP 版本: | 4.0+ |