您的位置:首页 > 编程语言 > PHP开发

php实现window平台的checkdnsrr函数

2015-05-27 10:50 417 查看

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;
}
}

您可能感兴趣的文章:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  php window checkdnsrr 函数