Convert an IPv4 address into a long integer:
<?php
$ip = gethostbyname("www.91xjr.com");
$out = "The following URLs are equivalent:<br>";
$out .= "https://www.91xjr.com/, https://" . $ip . "/, and https://" . sprintf("%u", ip2long($ip)) . "/";
echo $out;
?>
The ip2long() function converts an IPv4 address into a long integer.
ip2long(
address)
Parameter | Description |
---|---|
address | Required. Specifies a standard IP address |
Return Value: | A long integer. FALSE on failure |
---|---|
PHP Version: | 4.0+ |
PHP Changelog: | PHP 5.5: Before this version, on Windows, this function might return a valid number even if the passed value was not an IPv4 address. PHP 5.2: PHP 5.5: Before this version, this function might return a valid number even if the passed value was not an IPv4 address. |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!