PHP实现的随机IP函数【国内IP段】
作者:lee 时间:2024-06-05 09:49:17
本文实例讲述了PHP实现的随机IP函数。分享给大家供大家参考,具体如下:
function get_rand_ip(){
$arr_1 = array("218","218","66","66","218","218","60","60","202","204","66","66","66","59","61","60","222","221","66","59","60","60","66","218","218","62","63","64","66","66","122","211");
$randarr= mt_rand(0,count($arr_1));
$ip1id = $arr_1[$randarr];
$ip2id= round(rand(600000, 2550000) / 10000);
$ip3id= round(rand(600000, 2550000) / 10000);
$ip4id= round(rand(600000, 2550000) / 10000);
return $ip1id . "." . $ip2id . "." . $ip3id . "." . $ip4id;
}
echo get_rand_ip();//输出:211.104.85.78
希望本文所述对大家PHP程序设计有所帮助。
标签:PHP,随机IP
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Python源码学习之PyType_Type和PyBaseObject_Type详解
2023-08-03 15:50:05
![](https://img.aspxhome.com/file/2023/3/61733_0s.png)
python里使用正则表达式的组嵌套实例详解
2021-05-09 18:11:34
微信公众平台开发入门教程(图文详解)
2023-06-21 11:10:05
![](https://img.aspxhome.com/file/2023/6/82406_0s.jpg)
mysql中的保留字段产生的问题
2024-01-14 06:30:58
Python使用树状图实现可视化聚类详解
2021-07-08 13:41:25
![](https://img.aspxhome.com/file/2023/9/123629_0s.png)
pandas实现数据合并的示例代码
2021-03-14 01:10:59
FSO读取BMP,JPG,PNG,GIF图像文件信息的函数
2007-08-04 09:56:00
解决Python 中JSONDecodeError: Expecting value: line 1 column 1 (char 0)错误
2023-10-30 22:42:03
![](https://img.aspxhome.com/file/2023/6/71426_0s.png)
node.js使用免费的阿里云ip查询获取ip所在地【推荐】
2024-05-13 09:30:23
![](https://img.aspxhome.com/file/2023/3/125723_0s.jpg)
PHP开发实现快递查询功能详解
2023-11-24 12:19:39
![](https://img.aspxhome.com/file/2023/3/55723_0s.png)
Vue.js实现微信过渡动画左右切换效果
2023-07-02 17:03:10
![](https://img.aspxhome.com/file/2023/4/139904_0s.gif)
python对矩阵进行转置的2种处理方法
2023-12-01 09:18:17
oracle 性能优化建议小结
2024-01-19 10:50:53
python模拟表单提交登录图书馆
2021-11-06 19:20:42
![](https://img.aspxhome.com/file/2023/5/65935_0s.png)
Python GUI库Tkiner使用方法代码示例
2022-03-26 04:51:29
![](https://img.aspxhome.com/file/2023/5/131305_0s.png)
MySQL 4.0 升级到mysql 5.0的方法
2024-01-18 10:07:12
快速解决js动态改变dom元素属性后页面及时渲染的问题
2024-05-02 16:17:39
python3 面向对象__类的内置属性与方法的实例代码
2023-03-24 10:03:19
Python报错SyntaxError:unexpected EOF while parsing的解决办法
2023-10-01 10:29:54
Python实现复杂对象转JSON的方法示例
2021-11-14 09:55:47