这篇文章主要介绍了php实现window平台的checkdnsrr函数,php的自带checkdnsrr函数只在linux平台有效,本文就模拟出了一个window下可以使用的checkdnsrr函数,需要的朋友可以参考下
PHP的自带checkdnsrr函数只在linux平台有效。使用惯了在window平台不能使用的话给兼容性带来麻烦。
因此写了个checkdnsrr模拟函数在window平台环境使用。
?
|
1 立即学习“PHP免费学习笔记(深入)”; 2 3 4 5 6 7 8 9 10 11 12 13 |
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怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号