gethostbynamel

(PHP 4, PHP 5, PHP 7, PHP 8)

gethostbynamel 获取互联网主机名对应的 IPv4 地址列表

说明

gethostbynamel(string $hostname): array|false

返回互联网主机名 hostname 解析出来的 IPv4 地址列表。

参数

hostname

主机名

返回值

返回 IPv4 地址数组,或在 hostname 无法解析时返回 false

范例

示例 #1 gethostbynamel() 例子

<?php
$hosts
= gethostbynamel('www.example.com');
print_r($hosts);
?>

以上例程会输出:

Array
(
    [0] => 192.0.34.166
)

参见

  • gethostbyname() - 返回主机名对应的 IPv4地址。
  • gethostbyaddr() - 获取指定 IP 地址对应的 Internet 主机名
  • checkdnsrr() - 给指定的主机(域名)或者IP地址做DNS通信检查
  • getmxrr() - 获取 Internet 主机名对应的 MX 记录
  • named(8) 手册页

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top