ip2long()函数将 IPV4 的字符串互联网协议转换成长整型数字。
int ip2long ( string $ip_address )
它用于将ipv4地址转换为长整数。
返回IP地址转换后的数字 或 FALSE 如果 ip_address 是无效的。
| 序号 | 参数和说明 |
|---|---|
| 1 | ip_address 它包含一个IP地址。 |
试试下面的实例
<?php
$ip = gethostbyname('www.cainiaoplus.com');
$out = "以下三个URL是等效:
\n";
$out .= '/, http://' . $ip . '/,
和 http://' . sprintf("%u", ip2long($ip)) . "/
\n";
echo $out;
?>输出结果
以下三个URL等效: /, http://39.107.75.220/, http://661343196/