getmxrr

(PHP 4, PHP 5, PHP 7, PHP 8)

getmxrr獲取互聯(lián)網(wǎng)主機名對應的 MX 記錄

說明

getmxrr(string $hostname, array &$mxhosts, array &$weight = ?): bool

搜索 hostname對應的 MX DNS 記錄。

參數(shù)

hostname

互聯(lián)網(wǎng)主機名。

mxhosts

找到的 MX 記錄列表存放于 mxhosts 數(shù)組。

weight

提供了 weight 數(shù)組后,它會用找到的權重信息填充數(shù)組。

返回值

找到記錄返回 true,沒找到或者出錯時返回 false。

更新日志

版本 說明
5.3.0 Windows 平臺上也能用這個函數(shù)了。

注釋

注意:

本函數(shù)不應使用于地址驗證。 僅在 MX 記錄在 DNS 中找到時才會返回,然而根據(jù) ? RFC 2821, 沒有 MX 記錄時, hostname 本身就是 MX 主機,優(yōu)先級為 0。

注意:

在兼容 Windows 實現(xiàn)之前的版本, 可以使用 ? PEAR class 的 ? Net_DNS。

參見