禁止IP访问 $ip_prefix = '192.168.0.1'; if (substr($_SERVER['REMOTE_ADDR'], 0, strlen($ip_prefix)) != $ip_prefix ) die('Access denied');