Home > Article > Backend Development > PHP implements the checkdnsrr function of the window platform, windowcheckdnsrr_PHP tutorial
PHP’s own checkdnsrr function is only valid on the linux platform. If you are used to using it and it cannot be used on the window platform, it will cause trouble for compatibility.
So I wrote a checkdnsrr simulation function for use in the window platform environment.
if (!function_exists('checkdnsrr ')) { function checkdnsrr($host, $type) { if(!empty($host) && !empty($type)) { @exec('nslookup -type=' . escapeshellarg($type) . ' ' . escapeshellarg($host), $output); foreach ($output as $k => $line) { if(eregi('^' . $host, $line)) { return true; } } } return false; } }