PHP 中的 ip2long函数

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

ip2long - 语法

int ip2long ( string $ip_address )

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

Sr.No 参数 & Description
1

ip_address

它包含IP地址。

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/

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

技术教程推荐

从0开始学微服务 -〔胡忠想〕

iOS开发高手课 -〔戴铭〕

WebAssembly入门课 -〔于航〕

跟着高手学复盘 -〔张鹏〕

程序员的个人财富课 -〔王喆〕

React Native 新架构实战课 -〔蒋宏伟〕

超级访谈:对话玉伯 -〔玉伯〕

AI 应用实战课 -〔黄佳〕

Midjourney入门实践课 -〔Jovi〕

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