大网数据广告活动
PHP 语言与运行手册

The EventDnsBase class

· 52CE 我爱测

Represents Libevent's DNS base structure. Used to resolve DNS asynchronously, parse configuration files like resolv.conf etc.

The EventDnsBase class

(PECL event >= 1.2.6-beta)

Introduction

Represents Libevent's DNS base structure. Used to resolve DNS asynchronously, parse configuration files like resolv.conf etc.

Class synopsis

final class EventDnsBase {
/* Constants */
const int OPTION_SEARCH = 1;
const int OPTION_MISC = 4;
const int OPTIONS_ALL = 15;
const int DISABLE_WHEN_INACTIVE = 32768;
/* Methods */
public function __construct( EventBase $base , int|bool $initialize )
public function addNameserverIp( string $ip ): bool
public function addSearch( string $domain ): void
public function clearSearch(): void
public function countNameservers(): int
public function loadHosts( string $hosts ): bool
public function parseResolvConf( int $flags , string $filename ): bool
public function setOption( string $option , string $value ): bool
public function setSearchNdots( int $ndots ): bool
}

Predefined Constants

EventDnsBase::OPTION_SEARCH

Tells to read the domain and search fields from the resolv.conf file and the ndots option, and use them to decide which domains(if any) to search for hostnames that aren’t fully-qualified.

EventDnsBase::OPTION_NAMESERVERS

Tells to learn the nameservers from the resolv.conf file.

EventDnsBase::OPTION_MISC

EventDnsBase::OPTION_HOSTSFILE

Tells to read a list of hosts from /etc/hosts as part of loading the resolv.conf file.

EventDnsBase::OPTIONS_ALL

Tells to learn as much as it can from the resolv.conf file.

EventDnsBase::DISABLE_WHEN_INACTIVE

Do not prevent the libevent event loop from exiting when we have no active DNS requests.

EventDnsBase::INITIALIZE_NAMESERVERS

Process the resolv.conf.

EventDnsBase::NAMESERVERS_NO_DEFAULT

Do not add default nameserver if there are no nameservers in the resolv.conf.

Table of Contents

来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
PHP Documentation Group
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。