$pat = "/^(((1?\d{1,2})|(2[0-4]\d)|(25[0-5]))\.){3}((1?\d{1,2})|(2[0-4]\d)|(25[0-5]))$/";
if(preg_match($pat,$ip)){
$num = preg_match($pat,$ip);
return $num;
}else{
$num = preg_match($pat,$ip);
return $num;
}
}
echo fun("255.255.255.255");
查看更多关于php使用preg_match()函数验证ip地址的方法的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did3217