如何按日期排序

时间:2017-10-19 09:32:38

标签: php imap

我正在通过线程列出邮箱列表,如何按最近订单的收货日期排序到最早?

<?php

$nntp = imap_open('{mail.domain.com/imap}', 'email@domain.com', 'mypassword');
$threads = imap_thread($nntp);
foreach ($threads as $key => $val) {
  $tree = explode('.', $key);
  if ($tree[1] == 'num') {
    $header = @imap_headerinfo($nntp, $val);
    if ( $header ) {
        echo "<ul>\n\t<li>" . imap_utf8 ( $header->fromaddress ) . "<br>\n";
        echo "" . $header->to . "<br>\n";
        echo "" . $header->date . "<br>\n";
        echo "" . imap_utf8 ( $header->subject ) . "\n";
    }
  } elseif ($tree[1] == 'branch') {
    echo "\t</li>\n</ul>\n";
  }
}

imap_close($nntp);

?>

0 个答案:

没有答案
相关问题