php函数long2ip与ip2long
时间:2021-07-01 10:21:17
帮助过:29人阅读
long2ip — Converts an long integer address into a string in (IPv4) Internet standard dotted format
string long2ip ( string $proper_address )
The function long2ip() generates an Internet address in dotted format (i.e.: aaa.bbb.ccc.ddd) from the long integer representation
意思就是:用于将一个数字格式的IPv4地址转换成字符串格式(192.168.0.1)
而ip2long恰好与之相反
Converts an long integer address into a string in (IPv4) Internet standard dotted format
eg:
$ip = gethostbyname('www.csdn.net');
$num_ip = ip2long($ip);
echo $num_ip,'
';
echo long2ip($num_ip);
?>
结果:
以上就介绍了php函数long2ip与ip2long,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。