function.imap-get-quota.html
来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 151 行
HTML
151 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Retrieve the quota level settings, and usage statics per 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-fetchstructure.html">imap_fetchstructure</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.imap-get-quotaroot.html">imap_get_quotaroot</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-get-quota" class="refentry"> <div class="refnamediv"> <h1 class="refname">imap_get_quota</h1> <p class="verinfo">(PHP 4 >= 4.0.5, PHP 5)</p><p class="refpurpose"><span class="refname">imap_get_quota</span> — <span class="dc-title">Retrieve the quota level settings, and usage statics per mailbox</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">array</span> <span class="methodname"><b><b>imap_get_quota</b></b></span> ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$imap_stream</tt></span> , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$quota_root</tt></span> )</div> <p class="para rdfs-comment"> Retrieve the quota level settings, and usage statics per mailbox. </p> <p class="para"> For a non-admin user version of this function, please see the <a href="function.imap-get-quotaroot.html" class="function">imap_get_quotaroot()</a> function of PHP. </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">quota_root</tt></i></span> <dd> <p class="para"> <i><tt class="parameter">quota_root</tt></i> should normally be in the form of <i>user.name</i> where name is the mailbox you wish to retrieve information about. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns an array with integer values limit and usage for the given mailbox. The value of limit represents the total amount of space allowed for this mailbox. The usage value represents the mailboxes current level of capacity. Will return <b><tt>FALSE</tt></b> in the case of failure. </p> <p class="para"> As of PHP 4.3, the function more properly reflects the functionality as dictated by the <a href="http://www.faqs.org/rfcs/rfc2087" class="link external">» RFC2087</a>. The array return value has changed to support an unlimited number of returned resources (i.e. messages, or sub-folders) with each named resource receiving an individual array key. Each key value then contains an another array with the usage and limit values within it. </p> <p class="para"> For backwards compatibility reasons, the original access methods are still available for use, although it is suggested to update. </p> </div> <div class="refsect1 examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example"> <p><b>Example #1 <b>imap_get_quota()</b> example</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<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}"</span><span style="color: #007700">, </span><span style="color: #DD0000">"mailadmin"</span><span style="color: #007700">, </span><span style="color: #DD0000">"password"</span><span style="color: #007700">, </span><span style="color: #0000BB">OP_HALFOPEN</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">$quota_value </span><span style="color: #007700">= </span><span style="color: #0000BB">imap_get_quota</span><span style="color: #007700">(</span><span style="color: #0000BB">$mbox</span><span style="color: #007700">, </span><span style="color: #DD0000">"user.kalowsky"</span><span style="color: #007700">);<br />if (</span><span style="color: #0000BB">is_array</span><span style="color: #007700">(</span><span style="color: #0000BB">$quota_value</span><span style="color: #007700">)) {<br /> echo </span><span style="color: #DD0000">"Usage level is: " </span><span style="color: #007700">. </span><span style="color: #0000BB">$quota_value</span><span style="color: #007700">[</span><span style="color: #DD0000">'usage'</span><span style="color: #007700">];<br /> echo </span><span style="color: #DD0000">"Limit level is: " </span><span style="color: #007700">. </span><span style="color: #0000BB">$quota_value</span><span style="color: #007700">[</span><span style="color: #DD0000">'limit'</span><span style="color: #007700">];<br />}<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> <p class="para"> <div class="example"> <p><b>Example #2 <b>imap_get_quota()</b> 4.3 or greater example</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<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}"</span><span style="color: #007700">, </span><span style="color: #DD0000">"mailadmin"</span><span style="color: #007700">, </span><span style="color: #DD0000">"password"</span><span style="color: #007700">, </span><span style="color: #0000BB">OP_HALFOPEN</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">$quota_values </span><span style="color: #007700">= </span><span style="color: #0000BB">imap_get_quota</span><span style="color: #007700">(</span><span style="color: #0000BB">$mbox</span><span style="color: #007700">, </span><span style="color: #DD0000">"user.kalowsky"</span><span style="color: #007700">);<br />if (</span><span style="color: #0000BB">is_array</span><span style="color: #007700">(</span><span style="color: #0000BB">$quota_values</span><span style="color: #007700">)) {<br /> </span><span style="color: #0000BB">$storage </span><span style="color: #007700">= </span><span style="color: #0000BB">$quota_values</span><span style="color: #007700">[</span><span style="color: #DD0000">'STORAGE'</span><span style="color: #007700">];<br /> echo </span><span style="color: #DD0000">"STORAGE usage level is: " </span><span style="color: #007700">. </span><span style="color: #0000BB">$storage</span><span style="color: #007700">[</span><span style="color: #DD0000">'usage'</span><span style="color: #007700">];<br /> echo </span><span style="color: #DD0000">"STORAGE limit level is: " </span><span style="color: #007700">. </span><span style="color: #0000BB">$storage</span><span style="color: #007700">[</span><span style="color: #DD0000">'limit'</span><span style="color: #007700">];<br /><br /> </span><span style="color: #0000BB">$message </span><span style="color: #007700">= </span><span style="color: #0000BB">$quota_values</span><span style="color: #007700">[</span><span style="color: #DD0000">'MESSAGE'</span><span style="color: #007700">];<br /> echo </span><span style="color: #DD0000">"MESSAGE usage level is: " </span><span style="color: #007700">. </span><span style="color: #0000BB">$message</span><span style="color: #007700">[</span><span style="color: #DD0000">'usage'</span><span style="color: #007700">];<br /> echo </span><span style="color: #DD0000">"MESSAGE limit is: " </span><span style="color: #007700">. </span><span style="color: #0000BB">$message</span><span style="color: #007700">[</span><span style="color: #DD0000">'limit'</span><span style="color: #007700">];<br /><br /> </span><span style="color: #FF8000">/* ... */<br /></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> <p class="para"> This function is currently only available to users of the c-client2000 or greater library. </p> <p class="para"> The given <i><tt class="parameter">imap_stream</tt></i> must be opened as the mail administrator, other wise this function will fail. </p> </div> <div class="refsect1 seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="function.imap-open.html" class="function" rel="rdfs-seeAlso">imap_open()</a></li> <li class="member"><a href="function.imap-set-quota.html" class="function" rel="rdfs-seeAlso">imap_set_quota()</a></li> <li class="member"><a href="function.imap-get-quotaroot.html" class="function" rel="rdfs-seeAlso">imap_get_quotaroot()</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-fetchstructure.html">imap_fetchstructure</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.imap-get-quotaroot.html">imap_get_quotaroot</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 + =
减小字号Ctrl + -
显示快捷键?