首 页 ASP ASP.NET PHP JSP Ajax DIV+CSS JavaScript XML C#
MySQL MSSQL Access Oracle Linux Server 电脑技巧 网络安全 建站经验 其它

PHP判断IP格式的函数

整理日期:2007年03月02日 【字体:


伊图教程网[www.etoow.com]
http://www.etoow.com/html/2007-03/1172834564.html
  foreach($ip as $ip_addr) {
    if ( !is_numeric($ip_addr) ) return 0;
    if ( $ip_addr<0 || $ip_addr>255 ) return 0;
  }
  return 1;
}
如果简单的判断格式a.b.c.d而不考虑abcd的值的话:
return (preg_match("/^([0-9]{1,3}\.){3}[0-9]{1,3}$/is", $str));
不过如果需要真的ip的时候就不好玩了
Tags:
PHP判断IP格式的函数
'http://www.etoow.com/html/2007-03/1172834564.html
1
 
信息搜索
  
联系我们关于本站广告服务设为首页 收藏本站友情链接网站地图
Copyright © Etoow.com Inc. All Rights Reserved