php 屏蔽指定IP或IP段
2016.05.28 | 1600閱讀 | 0條評(píng)論 | php
$denyIp = array('45.34.*','101.96.*');
$nowIp = real_ip();
foreach ($denyIp as $k=>$v)
{
if (strpos($v,'*') >0)
{
if (substr($nowIp,0,strpos($v,'*')) == substr($v,0,strpos($v,'*')))
exit();
}
elseif ($nowIp == $v)
exit();
}
發(fā)表評(píng)論