PHP Zend_Mail_Storage_Imap限制​​消息

时间:2016-02-11 06:17:14

标签: php zend-framework

我正在使用Zend_Mail_Storage_Imap从我的帐户收到邮件,该功能正常但是..如何限制结果以显示和准备分页?

Verb      | Path                  | Method to modify  |
----------|-----------------------|-----------------  |
GET       | `/photo`              | addResourceIndex  |
GET       | `/photo/create`       | addResourceCreate |
POST      | `/photo`              | addResourceStore  |
GET       | `/photo/{photo}`      | addResourceShow   |
GET       | `/photo/{photo}/edit` | addResourceEdit   |
PUT/PATCH | `/photo/{photo}`      | addResourceUpdate |
DELETE    | `/photo/{photo}`      | addResourceDestroy|

1 个答案:

答案 0 :(得分:2)

Zend_Mail_Storage类的分页很简单。它们都实现了迭代器接口,并且可以与LimitIterator结合使用以进行分页。唯一的问题是它们以1而不是0开头,因为这就是所有邮件接口所做的事情。

$mail = new Zend_Mail_Storage_Imap(array('host'     => localhost, 
                                         'user'     => 'test', 
                                         'password' => 'secret')); 

$mail = new LimitIterator($mail, 1, 50); 

print_r(iterator_to_array($mail));