php imap如何搜索未读内容并按日期对其进行排序? [英] php imap how to search unread and also sort them by date?

查看:131
本文介绍了php imap如何搜索未读内容并按日期对其进行排序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以获取未读消息并按日期对消息进行排序?我有

Is it possible to get the unread messages and also sort them messages by date ? I have

$messages = imap_search($imap,"UNSEEN");
  imap_sort($imap, SORTDATE, 1);

但是我想知道是否不应该

but I'm wondering if it shouldn't be

  imap_sort($imap, SORTDATE, 1);
$messages = imap_search($imap,"UNSEEN");

还是其他?

推荐答案

如果使用imap_sort,则不需要使用imap_search,因为imap_sort会接受参数$ search_criteria和imap_search.假设imap_sort类似于imap_search,但您也可以将结果排序.

If you use imap_sort you don't need to use imap_search, as imap_sort admits a parameter $search_criteria as well as imap_search. Let's say imap_sort is like imap_search, but you can also get the results ordered.

$messages = imap_sort($imap, SORTDATE, 1, SE_UID, 'UNSEEN');

这篇关于php imap如何搜索未读内容并按日期对其进行排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆