我正在使用以下代码段来重定向 IP 地址数组。我想知道如何将整个 IP 地址范围/块添加到我不允许的数组中......
<?php // Let's redirect certain IP addresses to a "Page Not Found"
$disallowed = array("76.105.99.106");
$ip = $_SERVER['REMOTE_ADDR'];
if(in_array($ip, $disallowed)) {
header("Location: http://google.com");
exit;
}
?>
我尝试使用“76.105.99.*”、“76.105.99”、“76.105.99.0-76.105.99.255”,但没有任何运气。
由于其他原因,我需要使用 PHP 而不是 mod_rewrite 和 .htaccess。