|
|
|
|
| Tutorial |
Chapter 7 Cutting-Edge Applications
<var name=’array’>
<array length=’3’>
<number>1</number>
<number>2</number>
<number>3</number>
</array>
</var>
<var name=’hash’>
<struct>
<var name=’foo’>
<string>bar</string>
</var>
<var name=’baz’>
<string>fubar</string>
</var>
</struct>
</var>
</struct>
</data>
</wddxPacket>
PHP and WDDX
Because WDDX uses XML for the representation of data structures, you need to
compile PHP with both XML and WDDX in order to use it. If you’ve done that, the
following functions are at your disposal:
n wddx_serialize_value()
n wddx_serialize_vars()
n wddx_packet_start()
n wddx_add_vars()
n wddx_packet_end()
n wddx_deserialize()
Using these functions, you can serialize PHP variables into WDDX packets and
deserialize WDDX packets.
The WDDX Functions
Using the WDDX functions, there are three different ways to construct a packet.The
most basic method is to use wddx_serialize_value().This function takes one variable
plus an optional comment, and creates a WDDX packet out of it:
$var = “This is a string.”;
print(wddx_serialize_value($var, “This is a comment.”));
Listing 7.6 Continued
|
|
|
|
|
|
| Link Partners: Asia florist, Flowers to India, Hong kong flowers, Site submit, Cheap web hosting, China florist, Japan florist |
|