js驗證回送地址,IP地址不能以127開頭
回送地址(127.x.x.x)是本機回送地址(Loopback Address)
var ipNotStartWith127 = function(ip) { try { var data = https://www.cnblogs.com/sirdong/p/ip.split("."), ip1; return 4 == data.length && 127 !== parseInt(data[0]) } catch (e) { return !1 } } console.log(ipNotStartWith127("127.0.0.1")); // false console.log(ipNotStartWith127("192.168.1.1")); // true
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/158306.html
標籤:JavaScript
