function.msg-send.html

来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 190 行

HTML
190
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Send a message to a message queue</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.msg-remove-queue.html">msg_remove_queue</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.msg-set-queue.html">msg_set_queue</a></div> <div class="up"><a href="ref.sem.html">Semaphore Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.msg-send" class="refentry"> <div class="refnamediv">  <h1 class="refname">msg_send</h1>  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5)</p><p class="refpurpose"><span class="refname">msg_send</span> &mdash; <span class="dc-title">Send a message to a message queue</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>msg_send</b></b></span>    ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$queue</tt></span>   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$msgtype</tt></span>   , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <tt class="parameter">$message</tt></span>   [, <span class="methodparam"><span class="type">bool</span> <tt class="parameter">$serialize</tt></span>   [, <span class="methodparam"><span class="type">bool</span> <tt class="parameter">$blocking</tt></span>   [, <span class="methodparam"><span class="type">int</span> <tt class="parameter reference">&$errorcode</tt></span>  ]]] )</div>  <p class="para rdfs-comment">   <b>msg_send()</b> sends a <i><tt class="parameter">message</tt></i> of type   <i><tt class="parameter">msgtype</tt></i> (which MUST be greater than 0) to   the message queue specified by <i><tt class="parameter">queue</tt></i>.  </p> </div> <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>    <dt>     <span class="term"><i><tt class="parameter">queue</tt></i></span>     <dd>      <p class="para">      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">msgtype</tt></i></span>     <dd>      <p class="para">      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">message</tt></i></span>     <dd>      <p class="para">      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">serialize</tt></i></span>     <dd>      <p class="para">       The optional <i><tt class="parameter">serialize</tt></i> controls how the       <i><tt class="parameter">message</tt></i> is sent.  <i><tt class="parameter">serialize</tt></i>       defaults to <b><tt>TRUE</tt></b> which means that the <i><tt class="parameter">message</tt></i> is       serialized using the same mechanism as the session module before being       sent to the queue.  This allows complex arrays and objects to be sent to       other PHP scripts, or if you are using the WDDX serializer, to any WDDX       compatible client.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">blocking</tt></i></span>     <dd>      <p class="para">       If the message is too large to fit in the queue, your script will wait       until another process reads messages from the queue and frees enough       space for your message to be sent.       This is called blocking; you can prevent blocking by setting the       optional <i><tt class="parameter">blocking</tt></i> parameter to <b><tt>FALSE</tt></b>, in which       case <b>msg_send()</b> will immediately return <b><tt>FALSE</tt></b> if the       message is too big for the queue, and set the optional       <i><tt class="parameter">errorcode</tt></i> to <b><tt>MSG_EAGAIN</tt></b>,       indicating that you should try to send your message again a little       later on.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">errorcode</tt></i></span>     <dd>      <p class="para">      </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> on success or <b><tt>FALSE</tt></b> on failure.  </p>  <p class="para">   Upon successful completion the message queue data structure is updated as   follows: <i><tt class="parameter">msg_lspid</tt></i> is set to the process-ID of the   calling process, <i><tt class="parameter">msg_qnum</tt></i> is incremented by 1 and   <i><tt class="parameter">msg_stime</tt></i> is set to the current time.  </p> </div> <div class="refsect1 seealso">  <h3 class="title">See Also</h3>  <p class="para">   <ul class="simplelist">    <li class="member"><a href="function.msg-remove-queue.html" class="function" rel="rdfs-seeAlso">msg_remove_queue()</a></li>    <li class="member"><a href="function.msg-receive.html" class="function" rel="rdfs-seeAlso">msg_receive()</a></li>    <li class="member"><a href="function.msg-stat-queue.html" class="function" rel="rdfs-seeAlso">msg_stat_queue()</a></li>    <li class="member"><a href="function.msg-set-queue.html" class="function" rel="rdfs-seeAlso">msg_set_queue()</a></li>   </ul>  </p> </div>  </div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.msg-remove-queue.html">msg_remove_queue</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.msg-set-queue.html">msg_set_queue</a></div> <div class="up"><a href="ref.sem.html">Semaphore Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?