以下是为您整理出来关于【ip地址转换】合集内容,如果觉得还不错,请帮忙转发推荐。
原文链接:https://blog.csdn.net/henryzhang2009/article/details/45706163 public class IPUtils {/*** 将字符串形式IP地址127.0.0.1转换10234564321* * @param strIP* @return*/public static long ip2Long(String strIP) {long[] ip = new long[4];// 先找到IP地址字符串中.的位置int position1 = strIP.indexOf(".");int position2 = strIP.indexOf(".", position1 + 1);int position3 = strIP.indexOf(".", position2 + 1);/...
- - 10.150.20.59 255.255.255.0 10.150.20.254 202.99.160.68 - 10.150.20.53 255.255.255.0 10.150.20.254 202.99.160.68 - 10.150.20.54 255.255.255.0 10.150.20.254 202.99.160.68 这段...
$ipArr = explode('.',$_SERVER['REMOTE_ADDR']);$ipVal = $ipArr[0] * 0x1000000+ $ipArr[1] * 0x10000+ $ipArr[2] * 0x100+ $ipArr[3];echo$ipVal.'';$ipArr = array(0 => floor( $ipVal/ 0x1000000) );$ipVint = $ipVal-($ipArr[0]*0x1000000); // for clarity$ipArr[1] = ($ipVint & 0xFF0000) >> 16;$ipArr[2] = ($ipVint & 0xFF00 ) >> 8;$ipArr[3] = $ipVint & 0xFF;$ipDotted = implode('.', $ipArr);echo$ipDott...