Home > Backend Development > PHP Tutorial > PHP implements the checkdnsrr function of the window platform, windowcheckdnsrr_PHP tutorial

PHP implements the checkdnsrr function of the window platform, windowcheckdnsrr_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 09:52:23
Original
928 people have browsed it

php implements the checkdnsrr function of the window platform. windowcheckdnsrr

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;
  }
}
Copy after login

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1008018.htmlTechArticlephp implements the checkdnsrr function of the window platform. windowcheckdnsrr 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...
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template