這篇文章主要介紹了php實現window平臺的checkdnsrr函數,PHP的自帶checkdnsrr函數只在linux平臺有效,本文就模擬出了一個window下可以使用的checkdnsrr函數,需要的朋友可以參考下
PHP的自帶checkdnsrr函數只在linux平臺有效。使用慣了在window平臺不能使用的話給兼容性帶來麻煩。
因此寫了個checkdnsrr模擬函數在window平臺環境使用。
- if (!function_exists('checkdnsrr ')) {
- function checkdnsrr($host, $type) {
- if(!emptyempty($host) && !emptyempty($type)) {
- @exec('nslookup -type=' . escapeshellarg($type) . ' ' . escapeshellarg($host), $output);
- foreach ($output as $k => $line) {
- if(eregi('^' . $host, $line)) {
- return true;
- }
- }
- }
- return false;
- }
- }
新聞熱點
疑難解答