略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: imap_expunge

2024-12-22

imap_expunge

(PHP 4, PHP 5, PHP 7, PHP 8)

imap_expungeDelete all messages marked for deletion

说明

imap_expunge(IMAP\Connection $imap): bool

Deletes all the messages marked for deletion by imap_delete(), imap_mail_move(), or imap_setflag_full().

参数

imap

IMAP\Connection 实例。

返回值

Returns true.

更新日志

版本 说明
8.1.0 现在 imap 参数接受 IMAP\Connection 实例,之前接受 资源(resource)
add a noteadd a note

User Contributed Notes 2 notes

up
14
boswachter at xs4all dot nl
16 years ago
@eisbrenner at gidn dot de

You shouldn't call imap_expunge until before closing the connection. imap_delete tags a message for deletion, imap_expunge deletes all tagged messages. i.e.:
for ($i = 0; $i < $num; $i++) {
  imap_delete($box, $i);
}
imap_expunge($box);

imap_expunge should not be in your inner loop.
up
4
Pavel Cernik
6 years ago
imap_expunge() may change order of messages which were loaded using imap_sort().
That means, if you use foreach() on result of imap_sort() function and each pass you move/delete a message and instantly expunge them, next cycle, messages will have different numbers than imap_sort() returned and the script will fail.

官方地址:https://www.php.net/manual/en/function.imap-expunge.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3