mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-17 21:16:57 +08:00
284 lines
11 KiB
HTML
284 lines
11 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
|
<title>This function returns an array of messages matching the given search criteria</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.imap-search" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">imap_search</h1>
|
|
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">imap_search</span> — <span class="dc-title">This function returns an array of messages matching the given search criteria</span></p>
|
|
|
|
</div>
|
|
<div class="refsect1 description" id="refsect1-function.imap-search-description">
|
|
<h3 class="title">说明</h3>
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>imap_search</strong></span>
|
|
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$imap_stream</code></span>
|
|
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$criteria</code></span>
|
|
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code><span class="initializer"> = SE_FREE</span></span>
|
|
[, <span class="methodparam"><span class="type">string</span> <code class="parameter">$charset</code><span class="initializer"> = <strong><code>NULL</code></strong></span></span>
|
|
]] ) : <span class="type">array</span></div>
|
|
|
|
<p class="para rdfs-comment">
|
|
This function performs a search on the mailbox currently opened
|
|
in the given <acronym title="Internet Message Access Protocol">IMAP</acronym> stream.
|
|
</p>
|
|
<p class="para">
|
|
For example, to match all unanswered messages sent by Mom, you'd
|
|
use: "UNANSWERED FROM mom". Searches appear to be case
|
|
insensitive. This list of criteria is from a reading of the UW
|
|
c-client source code and may be incomplete or
|
|
inaccurate (see also <a href="http://www.faqs.org/rfcs/rfc2060" class="link external">» RFC2060</a>,
|
|
section 6.4.4).
|
|
</p>
|
|
</div>
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.imap-search-parameters">
|
|
<h3 class="title">参数</h3>
|
|
<p class="para">
|
|
<dl>
|
|
|
|
<dt>
|
|
<code class="parameter">
|
|
imap_stream</code></dt>
|
|
<dd>
|
|
<p class="para">由 <span class="function"><a href="imap_open.html" class="function">imap_open()</a></span> 返回的 IMAP 流。</p></dd>
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">criteria</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
A string, delimited by spaces, in which the following keywords are
|
|
allowed. Any multi-word arguments (e.g.
|
|
<em>FROM "joey smith"</em>) must be quoted. Results will match
|
|
all <code class="parameter">criteria</code> entries.
|
|
<ul class="itemizedlist">
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
ALL - return all messages matching the rest of the criteria
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
ANSWERED - match messages with the \\ANSWERED flag set
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
BCC "string" - match messages with "string" in the Bcc: field
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
BEFORE "date" - match messages with Date: before "date"
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
BODY "string" - match messages with "string" in the body of the message
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
CC "string" - match messages with "string" in the Cc: field
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
DELETED - match deleted messages
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
FLAGGED - match messages with the \\FLAGGED (sometimes
|
|
referred to as Important or Urgent) flag set
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
FROM "string" - match messages with "string" in the From: field
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
KEYWORD "string" - match messages with "string" as a keyword
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
NEW - match new messages
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
OLD - match old messages
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
ON "date" - match messages with Date: matching "date"
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
RECENT - match messages with the \\RECENT flag set
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
SEEN - match messages that have been read (the \\SEEN flag is set)
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
SINCE "date" - match messages with Date: after "date"
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
SUBJECT "string" - match messages with "string" in the Subject:
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
TEXT "string" - match messages with text "string"
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
TO "string" - match messages with "string" in the To:
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
UNANSWERED - match messages that have not been answered
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
UNDELETED - match messages that are not deleted
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
UNFLAGGED - match messages that are not flagged
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
UNKEYWORD "string" - match messages that do not have the
|
|
keyword "string"
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
UNSEEN - match messages which have not been read yet
|
|
</span>
|
|
</li>
|
|
</ul>
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">options</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
Valid values for <code class="parameter">options</code> are
|
|
<strong><code>SE_UID</code></strong>, which causes the returned array to
|
|
contain UIDs instead of messages sequence numbers.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">charset</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
MIME character set to use when searching strings.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
</dl>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
<div class="refsect1 returnvalues" id="refsect1-function.imap-search-returnvalues">
|
|
<h3 class="title">返回值</h3>
|
|
<p class="para">
|
|
Returns an array of message numbers or UIDs.
|
|
</p>
|
|
<p class="para">
|
|
Return <strong><code>FALSE</code></strong> if it does not understand the search
|
|
<code class="parameter">criteria</code> or no messages have been found.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 examples" id="refsect1-function.imap-search-examples">
|
|
<h3 class="title">范例</h3>
|
|
<div class="example" id="example-4036">
|
|
<p><strong>Example #1 <span class="function"><strong>imap_search()</strong></span> example</strong></p>
|
|
<div class="example-contents">
|
|
<div class="phpcode"><pre><span style="color: #000000">
|
|
<span style="color: #0000BB"><?php<br />$conn </span><span style="color: #007700">= </span><span style="color: #0000BB">imap_open</span><span style="color: #007700">(</span><span style="color: #DD0000">'{imap.example.com:993/imap/ssl}INBOX'</span><span style="color: #007700">, </span><span style="color: #DD0000">'foo@example.com'</span><span style="color: #007700">, </span><span style="color: #DD0000">'pass123'</span><span style="color: #007700">, </span><span style="color: #0000BB">OP_READONLY</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$some </span><span style="color: #007700">= </span><span style="color: #0000BB">imap_search</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #DD0000">'SUBJECT "HOWTO be Awesome" SINCE "8 August 2008"'</span><span style="color: #007700">, </span><span style="color: #0000BB">SE_UID</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$msgnos </span><span style="color: #007700">= </span><span style="color: #0000BB">imap_search</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #DD0000">'ALL'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$uids </span><span style="color: #007700">= </span><span style="color: #0000BB">imap_search</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #DD0000">'ALL'</span><span style="color: #007700">, </span><span style="color: #0000BB">SE_UID</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$some</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$msgnos</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$uids</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span>
|
|
</span>
|
|
</pre></div>
|
|
</div>
|
|
|
|
<div class="example-contents"><p>以上例程的输出类似于:</p></div>
|
|
<div class="example-contents screen">
|
|
<div class="cdata"><pre>
|
|
Array
|
|
(
|
|
[0] => 4
|
|
[1] => 6
|
|
[2] => 11
|
|
)
|
|
Array
|
|
(
|
|
[0] => 1
|
|
[1] => 2
|
|
[2] => 3
|
|
[3] => 4
|
|
[4] => 5
|
|
[5] => 6
|
|
)
|
|
Array
|
|
(
|
|
[0] => 1
|
|
[1] => 4
|
|
[2] => 6
|
|
[3] => 8
|
|
[4] => 11
|
|
[5] => 12
|
|
)
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 seealso" id="refsect1-function.imap-search-seealso">
|
|
<h3 class="title">参见</h3>
|
|
<p class="para">
|
|
<ul class="simplelist">
|
|
<li class="member"><span class="function"><a href="imap_listscan.html" class="function" rel="rdfs-seeAlso">imap_listscan()</a> - Returns the list of mailboxes that matches the given text</span></li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
|
|
</div></div></div></body></html> |