我正在尝试通过 dns_get_record() 获取域的 dns 记录,但是当插入变量时该函数似乎不起作用..这是我的代码
<form action="" method="post">
<input type="text" name="host" placeholder="Enter IP or Domain"/>
<select name="dns">
<option value="DNS_A" selected="selected">A</option>
....
<option value="DNS_ANY">ANY</option>
</select>
</form>
<?php
$host=$_POST['host'];
$dns=$_POST['dns'];
$type=end(explode('_',$dns));
if ($host==""){
exit();
}
echo "Results for $host $type record<br />";
$result = dns_get_record($host, $dns);
echo "Result = ";
print_r($result);
?>
但如果我把
$result = dns_get_record($host, DNS_A);
代替
$result = dns_get_record($host, $dns);
它有效..帮助!