📄 function.imap-delete.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Mark a message for deletion from current mailbox</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.imap-createmailbox.html">imap_createmailbox</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.imap-deletemailbox.html">imap_deletemailbox</a></div> <div class="up"><a href="ref.imap.html">IMAP Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.imap-delete" class="refentry"> <div class="refnamediv"> <h1 class="refname">imap_delete</h1> <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">imap_delete</span> — <span class="dc-title">Mark a message for deletion from current mailbox</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><b><b>imap_delete</b></b></span> ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$imap_stream</tt></span> , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$msg_number</tt></span> [, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$options</tt></span> ] )</div> <p class="para rdfs-comment"> Marks messages listed in <i><tt class="parameter">msg_number</tt></i> for deletion. Messages marked for deletion will stay in the mailbox until either <a href="function.imap-expunge.html" class="function">imap_expunge()</a> is called or <a href="function.imap-close.html" class="function">imap_close()</a> is called with the optional parameter <b><tt>CL_EXPUNGE</tt></b>. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt><span class="term"><i><tt class="parameter">imap_stream</tt></i></span><dd><p class="para">An IMAP stream returned by <a href="function.imap-open.html" class="function">imap_open()</a>.</p></dd></dt> <dt> <span class="term"><i><tt class="parameter">msg_number</tt></i></span> <dd> <p class="para"> The message number </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">options</tt></i></span> <dd> <p class="para"> You can set the <b><tt>FT_UID</tt></b> which tells the function to treat the <i><tt class="parameter">msg_number</tt></i> argument as an <i>UID</i>. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <b><tt>TRUE</tt></b>. </p> </div> <div class="refsect1 examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example"> <p><b>Example #1 <b>imap_delete()</b> example</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br /><br />$mbox </span><span style="color: #007700">= </span><span style="color: #0000BB">imap_open</span><span style="color: #007700">(</span><span style="color: #DD0000">"{imap.example.org}INBOX"</span><span style="color: #007700">, </span><span style="color: #DD0000">"username"</span><span style="color: #007700">, </span><span style="color: #DD0000">"password"</span><span style="color: #007700">)<br /> or die(</span><span style="color: #DD0000">"Can't connect: " </span><span style="color: #007700">. </span><span style="color: #0000BB">imap_last_error</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">$check </span><span style="color: #007700">= </span><span style="color: #0000BB">imap_mailboxmsginfo</span><span style="color: #007700">(</span><span style="color: #0000BB">$mbox</span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"Messages before delete: " </span><span style="color: #007700">. </span><span style="color: #0000BB">$check</span><span style="color: #007700">-></span><span style="color: #0000BB">Nmsgs </span><span style="color: #007700">. </span><span style="color: #DD0000">"<br />\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">imap_delete</span><span style="color: #007700">(</span><span style="color: #0000BB">$mbox</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$check </span><span style="color: #007700">= </span><span style="color: #0000BB">imap_mailboxmsginfo</span><span style="color: #007700">(</span><span style="color: #0000BB">$mbox</span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"Messages after delete: " </span><span style="color: #007700">. </span><span style="color: #0000BB">$check</span><span style="color: #007700">-></span><span style="color: #0000BB">Nmsgs </span><span style="color: #007700">. </span><span style="color: #DD0000">"<br />\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">imap_expunge</span><span style="color: #007700">(</span><span style="color: #0000BB">$mbox</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$check </span><span style="color: #007700">= </span><span style="color: #0000BB">imap_mailboxmsginfo</span><span style="color: #007700">(</span><span style="color: #0000BB">$mbox</span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"Messages after expunge: " </span><span style="color: #007700">. </span><span style="color: #0000BB">$check</span><span style="color: #007700">-></span><span style="color: #0000BB">Nmsgs </span><span style="color: #007700">. </span><span style="color: #DD0000">"<br />\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">imap_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$mbox</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> </p> </div> <div class="refsect1 notes"> <h3 class="title">Notes</h3> <blockquote><p><b class="note">Note</b>: POP3 mailboxes do not have their message flags saved between connections, so <a href="function.imap-expunge.html" class="function">imap_expunge()</a> must be called during the same connection in order for messages marked for deletion to actually be purged. <br /> </p></blockquote> </div> <div class="refsect1 seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="function.imap-undelete.html" class="function" rel="rdfs-seeAlso">imap_undelete()</a></li> <li class="member"><a href="function.imap-expunge.html" class="function" rel="rdfs-seeAlso">imap_expunge()</a></li> <li class="member"><a href="function.imap-close.html" class="function" rel="rdfs-seeAlso">imap_close()</a></li> </ul> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.imap-createmailbox.html">imap_createmailbox</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.imap-deletemailbox.html">imap_deletemailbox</a></div> <div class="up"><a href="ref.imap.html">IMAP Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -