《PHP編程:php實現window平臺的checkdnsrr函數》要點:
本文介紹了PHP編程:php實現window平臺的checkdnsrr函數,希望對您有用。如果有疑問,可以聯系我們。
PHP應用PHP的自帶checkdnsrr函數只在linux平臺有效.使用慣了在window平臺不克不及使用的話給兼容性帶來麻煩.
PHP應用因此寫了個checkdnsrr模擬函數在window平臺情況使用.
PHP利用
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編程:php實現window平臺的checkdnsrr函數》討論,分享您的想法,維易PHP學院為您提供專業教程。