欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP實現的隨機IP函數【國內IP段】

 更新時間:2016年07月20日 12:25:25   作者:lee  
這篇文章主要介紹了PHP實現的隨機IP函數,可實現輸出國內IP段的功能,涉及php字符串與數組的計算操作相關技巧,需要的朋友可以參考下

本文實例講述了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網絡編程技巧總結》、《php curl用法總結》、《php socket用法總結》、《php正則表達式用法總結》、《php字符串(string)用法總結》、《PHP數組(Array)操作技巧大全》、《PHP數學運算技巧總結》、《php面向對象程序設計入門教程》、《PHP數據結構與算法教程》、《php程序設計算法總結》及《php常見數據庫操作技巧匯總

希望本文所述對大家PHP程序設計有所幫助。

相關文章

最新評論