无法在PHP中沉默imap_open错误通知

Rag*_*nar 7 php imap-open

我正在使用PHP 5.3.5并且我正在使用

$this->marubox=@imap_open($this->server,$this->username,$this->password);
Run Code Online (Sandbox Code Playgroud)

@符号应该使错误报告无声,但它没有,我确信错误发生在这一行.我希望我的应用程序能够识别问题本身并做出反应并且不会出现NOTICE错误,因为我的公司开发策略,我无法关闭整个PHP的错误报告.

没有@我得到:

imap_open()[function.imap-open]:无法打开流{pop3.seznam.cz:110/pop3}INBOX我得到:注意未知:身份验证失败(身份验证失败)(errflg = 1)

如果登录信息正常,则打开连接并且不会发生错误.

当imap_open没有设法连接时,我总是收到NOTICE错误,而且它正在弄乱我的JSON结果.请问如何沉默?

Rag*_*nar 22

我补充道

$this->marubox=@imap_open($this->server,$this->username,$this->password);
imap_errors();
imap_alerts();
Run Code Online (Sandbox Code Playgroud)

并且imap_errors();imap_alerts();做魔术:)