array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.gethostbynamel.php', 1 => 'gethostbynamel', ), 'up' => array ( 0 => 'ref.network.php', 1 => '网络 函数', ), 'prev' => array ( 0 => 'function.gethostbyname.php', 1 => 'gethostbyname', ), 'next' => array ( 0 => 'function.gethostname.php', 1 => 'gethostname', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/network/functions/gethostbynamel.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
gethostbynamel — 获取互联网主机名对应的 IPv4 地址列表
hostname
主机名
返回 IPv4 地址数组,或在 hostname
无法解析时返回 false
。
示例 #1 gethostbynamel() 例子
<?php
$hosts = gethostbynamel('www.example.com');
print_r($hosts);
?>
以上示例会输出:
Array ( [0] => 192.0.34.166 )
named(8)
手册页