Home > php教程 > php手册 > body text

php实现window平台的checkdnsrr函数,windowcheckdnsrr

WBOY
Release: 2016-06-13 09:02:57
Original
1402 people have browsed it

php实现window平台的checkdnsrr函数,windowcheckdnsrr

PHP的自带checkdnsrr函数只在linux平台有效。使用惯了在window平台不能使用的话给兼容性带来麻烦。

因此写了个checkdnsrr模拟函数在window平台环境使用。

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

Related labels:
source:php.cn
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template