Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 05cd670d8a02b2b4a0ffb1756f2e8308 > files > 2589

php-manual-zh-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>msg_send</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="PHP 手册"
HREF="index.html"><LINK
REL="UP"
TITLE="Semaphore, Shared Memory and IPC Functions"
HREF="ref.sem.html"><LINK
REL="PREVIOUS"
TITLE="msg_remove_queue"
HREF="function.msg-remove-queue.html"><LINK
REL="NEXT"
TITLE="msg_set_queue"
HREF="function.msg-set-queue.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=UTF-8"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP 手册</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.msg-remove-queue.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.msg-set-queue.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.msg-send"
></A
>msg_send</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN205634"
></A
><P
>    (PHP 4 &#62;= 4.3.0, PHP 5)</P
>msg_send&nbsp;--&nbsp;
     Send a message to a message queue
    </DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN205637"
></A
><H2
>Description</H2
>bool <B
CLASS="methodname"
>msg_send</B
> ( resource queue, int msgtype, mixed message [, bool serialize [, bool blocking [, int &#38;errorcode]]] )<BR
></BR
><P
>&#13;     <B
CLASS="function"
>msg_send()</B
> sends a <CODE
CLASS="parameter"
>message</CODE
> of type
     <CODE
CLASS="parameter"
>msgtype</CODE
> (which MUST be greater than 0) to
     the message queue specified by <CODE
CLASS="parameter"
>queue</CODE
>.
    </P
><P
>&#13;     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 <CODE
CLASS="parameter"
>blocking</CODE
> parameter to <TT
CLASS="constant"
><B
>FALSE</B
></TT
>, in which
     case <B
CLASS="function"
>msg_send()</B
> will immediately return <TT
CLASS="constant"
><B
>FALSE</B
></TT
> if the
     message is too big for the queue, and set the optional
     <CODE
CLASS="parameter"
>errorcode</CODE
> to <TT
CLASS="constant"
><B
>MSG_EAGAIN</B
></TT
>, indicating that you should
     try to send your message again a little later on.
    </P
><P
>&#13;     The optional <CODE
CLASS="parameter"
>serialize</CODE
> controls how the
     <CODE
CLASS="parameter"
>message</CODE
> is sent.  <CODE
CLASS="parameter"
>serialize</CODE
>
     defaults to <TT
CLASS="constant"
><B
>TRUE</B
></TT
> which means that the <CODE
CLASS="parameter"
>message</CODE
> 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
><P
>&#13;     Upon successful completion the message queue data structure is updated as
     follows: <CODE
CLASS="parameter"
>msg_lspid</CODE
> is set to the process-ID of the
     calling process, <CODE
CLASS="parameter"
>msg_qnum</CODE
> is incremented by 1 and
     <CODE
CLASS="parameter"
>msg_stime</CODE
> is set to the current time.
    </P
><P
>&#13;     See also <A
HREF="function.msg-remove-queue.html"
><B
CLASS="function"
>msg_remove_queue()</B
></A
>,
     <A
HREF="function.msg-receive.html"
><B
CLASS="function"
>msg_receive()</B
></A
>,
     <A
HREF="function.msg-stat-queue.html"
><B
CLASS="function"
>msg_stat_queue()</B
></A
> and
     <A
HREF="function.msg-set-queue.html"
><B
CLASS="function"
>msg_set_queue()</B
></A
>.
    </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.msg-remove-queue.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>起始页</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.msg-set-queue.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>msg_remove_queue</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.sem.html"
ACCESSKEY="U"
>上一级</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>msg_set_queue</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>