$rv){ if(array_key_exists($rk, $GLOBALS['arr_blacklist'])){//黑名单操作 foreach($GLOBALS['arr_blacklist'][$rk] as $bv){ $write_len += fwrite($fp, 'address=/' . $bv . '/127.0.0.1' . "\n"); } continue; } if(empty($rk)){//遗漏的域名,不会写入到最终的配置里 print_r($rv); continue; } if(!is_array($rv)){ $write_len += fwrite($fp, 'address=/' . $rv . '/127.0.0.1' . "\n"); continue; } array_unique($rv); $rk_found = false; if(in_array('.' . $rk, $rv)){ $write_len += fwrite($fp, 'address=/.' . $rk . '/127.0.0.1' . "\n"); $rk_found = true; } foreach($rv as $rvv){ if(!$rk_found || (strpos($rvv, '.' . $rk) === false)){ $write_len += fwrite($fp, 'address=/' . $rvv . '/127.0.0.1' . "\n"); } } } fclose($fp); return $write_len; } }