Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 0afeee9cca140e167a996902b9a677c5 > files > 3151

php-manual-en-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>WDDX Functions</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="Function Reference"
HREF="funcref.html"><LINK
REL="PREVIOUS"
TITLE="w32api_set_call_method"
HREF="function.w32api-set-call-method.html"><LINK
REL="NEXT"
TITLE="wddx_add_vars"
HREF="function.wddx-add-vars.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="reference"
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 Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.w32api-set-call-method.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.wddx-add-vars.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="reference"
><A
NAME="ref.wddx"
></A
><DIV
CLASS="TITLEPAGE"
><H1
CLASS="title"
>CVI. WDDX Functions</H1
><DIV
CLASS="PARTINTRO"
><A
NAME="AEN95248"
></A
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="wddx.intro"
></A
>Introduction</H1
><P
>&#13;     These functions are intended for work with <A
HREF="http://www.openwddx.org/"
TARGET="_top"
>WDDX</A
>.
    </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="wddx.requirements"
></A
>Requirements</H1
><P
>&#13;     In order to use WDDX, you will need to install the expat library
     (which comes with Apache 1.3.7 or higher).
    </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="wddx.installation"
></A
>Installation</H1
><P
>&#13;  After installing expat compile PHP with
  <TT
CLASS="option"
>--enable-wddx</TT
>.
 </P
><P
> The windows version of <TT
CLASS="literal"
>PHP</TT
>
has built in support for this extension. You do not need to load any additional
extension in order to use these functions.</P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="wddx.configuration"
></A
>Runtime Configuration</H1
><P
>This extension has no configuration directives defined in <TT
CLASS="filename"
>php.ini</TT
>.</P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="wddx.resources"
></A
>Resource Types</H1
><P
>This extension has no resource types defined.</P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="wddx.constants"
></A
>Predefined Constants</H1
><P
>This extension has no constants defined.</P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="wddx.examples"
></A
>Examples</H1
><P
>&#13;     All the functions that serialize variables use the first
     element of an array to determine whether the array is to be
     serialized into an array or structure. If the first element has
     string key, then it is serialized into a structure, otherwise,
     into an array.
     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN95275"
></A
><P
><B
>Example 1. Serializing a single value</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>&#60;?php
print wddx_serialize_value("PHP to WDDX packet example", "PHP packet");
?&#62;</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
    </P
><P
>&#13;     This example will produce:
     <DIV
CLASS="informalexample"
><A
NAME="AEN95279"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>&#60;wddxPacket version='1.0'&#62;&#60;header comment='PHP packet'/&#62;&#60;data&#62;
&#60;string&#62;PHP to WDDX packet example&#60;/string&#62;&#60;/data&#62;&#60;/wddxPacket&#62;</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>

     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN95281"
></A
><P
><B
>Example 2. Using incremental packets</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>&#60;?php
$pi = 3.1415926;
$packet_id = wddx_packet_start("PHP");
wddx_add_vars($packet_id, "pi");

/* Suppose $cities came from database */
$cities = array("Austin", "Novato", "Seattle");
wddx_add_vars($packet_id, "cities");

$packet = wddx_packet_end($packet_id);
print $packet;
?&#62;</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
    </P
><P
>&#13;     This example will produce:
     <DIV
CLASS="informalexample"
><A
NAME="AEN95285"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="screen"
>&#60;wddxPacket version='1.0'&#62;&#60;header comment='PHP'/&#62;&#60;data&#62;&#60;struct&#62;
&#60;var name='pi'&#62;&#60;number&#62;3.1415926&#60;/number&#62;&#60;/var&#62;&#60;var name='cities'&#62;
&#60;array length='3'&#62;&#60;string&#62;Austin&#60;/string&#62;&#60;string&#62;Novato&#60;/string&#62;
&#60;string&#62;Seattle&#60;/string&#62;&#60;/array&#62;&#60;/var&#62;&#60;/struct&#62;&#60;/data&#62;&#60;/wddxPacket&#62;</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>
    </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
       If you want to serialize non-ASCII characters you have to set
       the appropriate locale before doing so (see 
       <A
HREF="function.setlocale.html"
><B
CLASS="function"
>setlocale()</B
></A
>).
     </P
></BLOCKQUOTE
></DIV
></DIV
></DIV
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="function.wddx-add-vars.html"
>wddx_add_vars</A
>&nbsp;--&nbsp;
     Add variables to a WDDX packet with the specified ID
    </DT
><DT
><A
HREF="function.wddx-deserialize.html"
>wddx_deserialize</A
>&nbsp;--&nbsp;Deserializes a WDDX packet</DT
><DT
><A
HREF="function.wddx-packet-end.html"
>wddx_packet_end</A
>&nbsp;--&nbsp;Ends a WDDX packet with the specified ID</DT
><DT
><A
HREF="function.wddx-packet-start.html"
>wddx_packet_start</A
>&nbsp;--&nbsp;
     Starts a new WDDX packet with structure inside it
    </DT
><DT
><A
HREF="function.wddx-serialize-value.html"
>wddx_serialize_value</A
>&nbsp;--&nbsp;Serialize a single value into a WDDX packet</DT
><DT
><A
HREF="function.wddx-serialize-vars.html"
>wddx_serialize_vars</A
>&nbsp;--&nbsp;Serialize variables into a WDDX packet</DT
></DL
></DIV
></DIV
></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.w32api-set-call-method.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.wddx-add-vars.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>w32api_set_call_method</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="funcref.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>wddx_add_vars</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>