getmxrr()函數(shù)獲取互聯(lián)網(wǎng)主機(jī)名對(duì)應(yīng)的 MX 記錄
bool getmxrr ( string $hostname , array &$mxhosts [, array &$weight ] )
搜索 hostname對(duì)應(yīng)的 MX DNS 記錄。
如果找到記錄,它將返回True,否則將返回false
試試下面的實(shí)例
<?php
getmxrr("baidu.com", $mx_records, $mx_weight);
for($i = 0;$i<count($mx_records);$i++){
$mxs[$mx_records[$i]] = $mx_weight[$i];
}
asort ($mxs);
$records = array_keys($mxs);
for($i = 0; $i < count($records); $i++){
echo $records[$i];
echo '<br/>';
}
?>上面的示例給出了如下結(jié)果
mx.maillb.baidu.com mx.n.shifen.com mx1.baidu.com jpmx.baidu.com mx50.baidu.com