uTools-Manuals/docs/php/imap_ping.html
2019-04-08 23:22:26 +08:00

68 lines
3.4 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>Check if the IMAP stream is still active</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.imap-ping" class="refentry">
<div class="refnamediv">
<h1 class="refname">imap_ping</h1>
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">imap_ping</span> &mdash; <span class="dc-title">Check if the IMAP stream is still active</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.imap-ping-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>imap_ping</strong></span>
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$imap_stream</code></span>
) : <span class="type">bool</span></div>
<p class="para rdfs-comment">
<span class="function"><strong>imap_ping()</strong></span> pings the stream to see if it&#039;s still
active. It may discover new mail; this is the preferred method for a
periodic &quot;new mail check&quot; as well as a &quot;keep alive&quot; for servers which
have inactivity timeout.
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.imap-ping-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>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.imap-ping-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
Returns <strong><code>TRUE</code></strong> if the stream is still alive, <strong><code>FALSE</code></strong> otherwise.
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.imap-ping-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-4032">
<p><strong>Example #1 <span class="function"><strong>imap_ping()</strong></span> Example</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$imap&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">imap_open</span><span style="color: #007700">(</span><span style="color: #DD0000">"{imap.example.org}"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"mailadmin"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"password"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;after&nbsp;some&nbsp;sleeping<br /></span><span style="color: #007700">if&nbsp;(!</span><span style="color: #0000BB">imap_ping</span><span style="color: #007700">(</span><span style="color: #0000BB">$imap</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;do&nbsp;some&nbsp;stuff&nbsp;to&nbsp;reconnect<br /></span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
</div>
</div></div></div></body></html>