百句空言,不如一个行动。凡事回归原点,不懂就不懂,努力学习;懂了也要相信人外有人,放下架子,谦虚,能力提升方可最大化!
本文实例讲述了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函数【国内IP段】就介绍到这了。自信,是走向成功的伴侣,是战胜困难的利剑,是达向理想彼岸的舟楫。有了它,就迈出了成功的第一步;有了它,就走上了义无反顾的追求路。更多相关PHP实现的随机IP函数【国内IP段】内容请查看相关栏目,小编编辑不易,再次感谢大家的支持!