PHP 中的 ip2long函数

首页 / PHP入门教程 / PHP 中的 ip2long函数

ip2long - 语法

int ip2long ( string $ip_address )

它用于将IPv4地址转换为长整数。

Sr.No 参数 & Description
1

ip_address

无涯教程网

它包含IP地址。

链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-function-ip2long.html

来源:LearnFk无涯教程网

ip2long - 返回值

它返回LONG INTEGER(长整数),否则显示一条消息,表示IP地址无效。

ip2long - 示例

<?php
   $ip=gethostbyname('www.learnfk.com');
   $out="The following URLs are equivalent:
\n";
   
   $out .= 'http://www.learnfk.com/, http://' . $ip . '/, 
      and http://' . sprintf("%u", ip2long($ip)) . "/
\n";
   
   echo $out;
?>

这将产生以下输出-

The following URLs are equivalent:
http://www.learnfk.com/, http://72.21.91.8/, and http://1209359112/

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

赵成的运维体系管理课 -〔赵成〕

Service Mesh实践指南 -〔周晶〕

Go语言核心36讲 -〔郝林〕

ZooKeeper实战与源码剖析 -〔么敬国〕

人人都能学会的编程入门课 -〔胡光〕

手机摄影 -〔@随你们去〕

容量保障核心技术与实战 -〔吴骏龙〕

深入浅出可观测性 -〔翁一磊〕

手把手教你落地DDD -〔钟敬〕

好记忆不如烂笔头。留下您的足迹吧 :)