$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)){ if(array_key_exists($rv, $GLOBALS['arr_whitelist'])){//白名单机制 continue; } $write_len += fwrite($fp, 'address=/' . $rv . '/127.0.0.1' . "\n"); continue; } $rv = array_unique($rv); if(in_array('.' . $rk, $rv) || in_array('www.' . $rk, $rv)){ $write_len += fwrite($fp, 'address=/.' . $rk . '/127.0.0.1' . "\n"); continue; } foreach($rv as $rvv){ if(array_key_exists($rvv, $GLOBALS['arr_whitelist'])){//白名单机制 continue; } $write_len += fwrite($fp, 'address=/' . $rvv . '/127.0.0.1' . "\n"); } } fclose($fp); return $write_len; } }