我有一个代码,我从数据库中获取域并通过 PHP getmxrr 函数传递它们。然后我将结果存储在数据库中。但是这个过程非常缓慢。有什么办法可以加快速度吗?
$stmt = $link->prepare($sql);
$stmt->execute();
$row = $stmt->fetchAll();
foreach ($row as $value) {
$domain = $value[0];
//getmxrr doesn't work without this
$string = preg_replace('/\s+/','',$domain);
if (getmxrr($string,$mxrecords)){
if(isset($mxrecords[0])){
$mx = $mxrecords[0];} else $mx = "False";
}
else{
$mx = "NULL";
}
$stmt1->execute(); //inserting the results in DB
}