Sophie

Sophie

distrib > Mandriva > 2008.1 > i586 > by-pkgid > 703d980c580707c382b4e43e25965bc5 > files > 11002

php-manual-pt_BR-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
>Funções WDDX</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="Manual do PHP"
HREF="index.html"><LINK
REL="UP"
TITLE="Referência das Funções"
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=UTF-8"></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"
>Manual do PHP</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.w32api-set-call-method.html"
ACCESSKEY="P"
>Anterior</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"
>Próxima</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="reference"
><A
NAME="ref.wddx"
></A
><DIV
CLASS="TITLEPAGE"
><H1
CLASS="title"
>CLXXIV. Funções WDDX</H1
><DIV
CLASS="PARTINTRO"
><A
NAME="AEN231630"
></A
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="wddx.intro"
>Introdução</A
></H1
><P
>&#13;     Essas funções tem o intuito de funcionara com <A
HREF="http://www.openwddx.org/"
TARGET="_top"
>WDDX</A
>.
    </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="wddx.requirements"
>Dependências</A
></H1
><P
>&#13;     Para usar WDDX, você precisará instalar a biblioteca expat
     (que vem com o Apache 1.3.7 ou superior).
    </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="wddx.installation"
>Instalação</A
></H1
><P
>&#13;  Depois de instalar o expat, compile o PHP com a opção
  <CODE
CLASS="option"
>--enable-wddx</CODE
>.
 </P
><P
>A versão para Windows do <TT
CLASS="literal"
>PHP</TT
>
 tem suporte embutido para esta extensão. Você não precisa carregar nenhuma extensão
 adicional para utilizar essas funções.</P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="wddx.configuration"
>Configurações em execução</A
></H1
><P
>Esta extensão não define nenhum parâmetro de configuração no <TT
CLASS="filename"
>php.ini</TT
>.</P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="wddx.resources"
>Tipos Resource</A
></H1
><P
>Esta extensão não possui nenhum tipo resource.</P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="wddx.constants"
>Constantes pré-definidas</A
></H1
><P
>Esta extensão não possui nenhuma constante.</P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="wddx.examples"
>Exemplos</A
></H1
><P
>&#13;     Todas as funções que serializam variáveis usam o primeiro
     elemento de um array para determinar se o array deve ser
     serializado em um array ou estrutura. Se o primeiro elemento
     tem uma chave string, então ele é serializado em uma estrutura, caso contrário,
     em um array.
    </P
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN231657"
></A
><P
><B
>Exemplo 1. Serializando um único valor com WDDX</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><code><font color="#000000">
<font color="#0000BB">&lt;?php<br /></font><font color="#007700">echo </font><font color="#0000BB">wddx_serialize_value</font><font color="#007700">(</font><font color="#DD0000">"PHP to WDDX packet example"</font><font color="#007700">, </font><font color="#DD0000">"PHP packet"</font><font color="#007700">);<br /></font><font color="#0000BB">?&gt;</font>
</font>
</code></TD
></TR
></TABLE
><P
>&#13;      Esse exemplo produzirá:
     </P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="screen"
>&#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
></DIV
></TD
></TR
></TABLE
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN231662"
></A
><P
><B
>Exemplo 2. Usando pacotes incrementais com WDDX</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><code><font color="#000000">
<font color="#0000BB">&lt;?php<br />$pi </font><font color="#007700">= </font><font color="#0000BB">3.1415926</font><font color="#007700">;<br /></font><font color="#0000BB">$packet_id </font><font color="#007700">= </font><font color="#0000BB">wddx_packet_start</font><font color="#007700">(</font><font color="#DD0000">"PHP"</font><font color="#007700">);<br /></font><font color="#0000BB">wddx_add_vars</font><font color="#007700">(</font><font color="#0000BB">$packet_id</font><font color="#007700">, </font><font color="#DD0000">"pi"</font><font color="#007700">);<br /><br /></font><font color="#FF8000">/* Suppose $cities came from database */<br /></font><font color="#0000BB">$cities </font><font color="#007700">= array(</font><font color="#DD0000">"Austin"</font><font color="#007700">, </font><font color="#DD0000">"Novato"</font><font color="#007700">, </font><font color="#DD0000">"Seattle"</font><font color="#007700">);<br /></font><font color="#0000BB">wddx_add_vars</font><font color="#007700">(</font><font color="#0000BB">$packet_id</font><font color="#007700">, </font><font color="#DD0000">"cities"</font><font color="#007700">);<br /><br /></font><font color="#0000BB">$packet </font><font color="#007700">= </font><font color="#0000BB">wddx_packet_end</font><font color="#007700">(</font><font color="#0000BB">$packet_id</font><font color="#007700">);<br />echo </font><font color="#0000BB">$packet</font><font color="#007700">;<br /></font><font color="#0000BB">?&gt;</font>
</font>
</code></TD
></TR
></TABLE
><P
>&#13;      Esse exemplo produzirá:
     </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
></DIV
></TD
></TR
></TABLE
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Nota: </B
>
      Se você quiser serializar caracteres não-ASCII, você tem que primeiro
      converter seus dados para UTF-8 (veja <A
HREF="function.utf8-encode.html"
><B
CLASS="function"
>utf8_encode()</B
></A
> e
      <A
HREF="function.iconv.html"
><B
CLASS="function"
>iconv()</B
></A
>).
     </P
></BLOCKQUOTE
></DIV
></DIV
></DIV
><DIV
CLASS="TOC"
><DL
><DT
><B
>Índice</B
></DT
><DT
><A
HREF="function.wddx-add-vars.html"
>wddx_add_vars</A
>&nbsp;--&nbsp;
     Adiciona variáveis a um pacote WDDX com o IP especificado
    </DT
><DT
><A
HREF="function.wddx-deserialize.html"
>wddx_deserialize</A
>&nbsp;--&nbsp;Sinônimo de <A
HREF="function.wddx-unserialize.html"
><B
CLASS="function"
>wddx_unserialize()</B
></A
></DT
><DT
><A
HREF="function.wddx-packet-end.html"
>wddx_packet_end</A
>&nbsp;--&nbsp;Finaliza um pacote WDDX com o ID especificado</DT
><DT
><A
HREF="function.wddx-packet-start.html"
>wddx_packet_start</A
>&nbsp;--&nbsp;
     Inicializa um novo pacote WDDX com uma estrutura dentro dele
    </DT
><DT
><A
HREF="function.wddx-serialize-value.html"
>wddx_serialize_value</A
>&nbsp;--&nbsp;Serializa um único valor em um pacote WDDX</DT
><DT
><A
HREF="function.wddx-serialize-vars.html"
>wddx_serialize_vars</A
>&nbsp;--&nbsp;Serializa variáveis em um pacote WDDX</DT
><DT
><A
HREF="function.wddx-unserialize.html"
>wddx_unserialize</A
>&nbsp;--&nbsp;De-serializa um pacote WDDX</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"
>Anterior</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Principal</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.wddx-add-vars.html"
ACCESSKEY="N"
>Próxima</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"
>Acima</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>wddx_add_vars</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>