Home > php教程 > php手册 > body text

IP转数字,数字转IP

WBOY
Release: 2016-06-13 10:37:40
Original
792 people have browsed it

echo $a=ip2long ("202.97.224.68");
echo "
-
";
echo long2ip ($a);

注:这里面有一个要注意的地方,大概由于PHP无法正确判断转换完的数字类型,出现负数的情况。

这时可用bindec(decbin(ip2long($IP))) 处理一下。
 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template