php实现window平台的checkdnsrr函数


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验证信用卡卡号是否正确函数
可以使用以下PHP函数,验证一个卡号是否是信用卡:functionvalidateCard($cardnumber){$cardnumber=preg_replace("/D|s/","",$cardnumber);#stripanynon-digits$cardlength=strlen($cardnum

PHP编译安装时常见错误解决办法
Thisarticleispostonhttps://coderwall.com/p/ggmpfaconfigure:error:xslt-confignotfound.Pleasereinstallthelibxslt=1.1.0distributionyum-yinstalllibxslt-develconfigure:error:Couldnotfindnet-snmp-configbina

php实现的mongodb操作类
mongo_db.phpphp/***CreatedbyPhpStorm.*User:yangyulong*Date:2015/5/26*Time:13:45*/classMongo_db{privatestatic$instanceof=NULL;public$mongo;private$host='localhost';private$port='27017';private$db;publi