inet_ntop()

创建于 2024-12-03 / 42
字体: [默认] [大] [更大]

❮ PHP Network 网络参考手册

实例

将打包地址转换为可读格式:

<?php
$addr = chr(127) . chr(0) . chr(1) . chr(1);
$exp = inet_ntop($addr);
echo $exp;
?> 亲自试一试 »

定义和用法

inet_ntop() 函数将 32 位 IPv4 或 128 位 IPv6 地址转换为可读格式。

语法

inet_ntop(address)

参数值

参数 描述
address 必需。指定 32 位 IPv4 或 128 位 IPv6 地址

技术细节

返回值: A human readable address on success. 失败时为 FALSE
PHP 版本: 5.1+
PHP 更新日志: PHP 5.3: 现在可在 Windows 平台上使用

❮ PHP Network 网络参考手册
0 人点赞过