-1
有没有办法跟踪imap_open()的实时连接时间?我试过imap_timeout(),但它只需要在php.ini中设置超时。我想在这里实现的是检查连接错误之前需要多长时间(类似于错误的用户名)。IMAP连接跟踪
$mbox = imap_open($this->data['ServerName'], $this->data['UserName'], $this->data['PassWord']);
$time = time();
// $mbox = imap_open("{}INBOX", "", "");
$x = imap_timeout(IMAP_OPENTIMEOUT);
echo "<pre>";
var_dump($x);
echo "</pre>";
var_dump(time() - $time);
if ($hdr = imap_check($mbox)) {
echo "Num Messages: " . $hdr->Nmsgs ."\n\n<br><br>";
return $mbox;
} else {
// error_log("Connection Failed. Could not Connect to the Mail Server", 0);
// $this->sendErrorMail("Connection Failed. Could not Connect to the Mail Server");
die("Connection Failed. Could not Connect to the Mail Server");
}
我已经试过了。我更新了上面的代码,但它仍然返回60秒,并且我还显示了连接发生错误之前的确切时间,它不一样。 – janers2014