312008
 

这实际上是由于 PHP 不允许在析构函数中抛出异常造成的,关于这个 issue 我已经提交到 issues 上:

http://framework.zend.com/issues/browse/ZF-2534

暂时没有想到好的解决方法。通常执行到析构函数时,邮件已经正确发出。所以最不济的方法就是用try…catch… 捕获异常,并忽略掉。

如下:

public function __destruct()
{

     try

    {
         if ($this->_connection instanceof Zend_Mail_Protocol_Smtp)

        {

            $this->_connection->quit();

            $this->_connection->disconnect();

         }

    catch(Zend_Exception $e)

    {

    }
}

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>