时时商务社区

标题: php实现window平台的checkdnsrr函数 [打印本页]

作者: 新格网络    时间: 2018-2-14 05:45

            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执行linux系统命令的常用函数使用说明
  • linux系统上支持php的 iconv()函数的方法
  • 浅析PHP程序防止ddos,dns,集群服务器攻击的解决办法
  • 利用PHP脚本在Linux下用md5函数加密字符串的方法
  • PHP几个实用自定义函数小结
  • PHP执行linux命令常用函数汇总
  • PHP的几个常用加密函数
  • PHP闭包函数详解
  • PHP函数超时处理方法
  • php强大的时间转换函数strtotime
  • 简单谈谈PHP中strlen 函数
  • PHP函数checkdnsrr用法详解(Windows平台用法)
            




    欢迎光临 时时商务社区 (http://bbs.4435.cn/) Powered by Discuz! X3.2