wddx_add_vars

Add variables to a WDDX packet with the specified ID

Warning

This function was REMOVED in PHP 7.4.0.

说明

bool wddx_add_vars ( resource $packet_id , mixed $var_name [, mixed $... ] )

Serializes the passed variables and add the result to the given packet.

参数

This function takes a variable number of parameters.

packet_id
A WDDX packet, returned by wddx_packet_start.

var_name
Can be either a string naming a variable or an array containing strings naming the variables or another array, etc.

...

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

wddx_deserialize

Unserializes a WDDX packet

Warning

This function was REMOVED in PHP 7.4.0.

说明

mixed wddx_deserialize ( string $packet )

Unserializes a WDDX packet.

Warning

Do not pass untrusted user input to wddx_deserialize. Unserialization can result in code being loaded and executed due to object instantiation and autoloading, and a malicious user may be able to exploit this. Use a safe, standard data interchange format such as JSON (via json_decode and json_encode) if you need to pass serialized data to the user.

参数

packet
A WDDX packet, as a string or stream.

返回值

Returns the deserialized value which can be a string, a number or an array. Note that structures are deserialized into associative arrays.

wddx_packet_end

Ends a WDDX packet with the specified ID

Warning

This function was REMOVED in PHP 7.4.0.

说明

string wddx_packet_end ( resource $packet_id )

Ends and returns the given WDDX packet.

参数

packet_id
A WDDX packet, returned by wddx_packet_start.

返回值

Returns the string containing the WDDX packet.

wddx_packet_start

Starts a new WDDX packet with structure inside it

Warning

This function was REMOVED in PHP 7.4.0.

说明

resource wddx_packet_start ([ string $comment ] )

Start a new WDDX packet for incremental addition of variables. It automatically creates a structure definition inside the packet to contain the variables.

参数

comment
An optional comment string.

返回值

Returns a packet ID for use in later functions, or FALSE on error.

wddx_serialize_value

Serialize a single value into a WDDX packet

Warning

This function was REMOVED in PHP 7.4.0.

说明

string wddx_serialize_value ( mixed $var [, string $comment ] )

Creates a WDDX packet from a single given value.

参数

var
The value to be serialized

comment
An optional comment string that appears in the packet header.

返回值

Returns the WDDX packet, or FALSE on error.

wddx_serialize_vars

Serialize variables into a WDDX packet

Warning

This function was REMOVED in PHP 7.4.0.

说明

string wddx_serialize_vars ( mixed $var_name [, mixed $... ] )

Creates a WDDX packet with a structure that contains the serialized representation of the passed variables.

参数

This function takes a variable number of parameters.

var_name
Can be either a string naming a variable or an array containing strings naming the variables or another array, etc.

...

返回值

Returns the WDDX packet, or FALSE on error.

范例

示例 #1 wddx_serialize_vars example

<?php
$a = 1;
$b = 5.5;
$c = array("blue", "orange", "violet");
$d = "colors";

$clvars = array("c", "d");
echo wddx_serialize_vars("a", "b", $clvars);
?>

以上例程会输出:

<wddxPacket version='1.0'><header/><data><struct><var name='a'><number>1</number></var>
<var name='b'><number>5.5</number></var><var name='c'><array length='3'>
<string>blue</string><string>orange</string><string>violet</string></array></var>
<var name='d'><string>colors</string></var></struct></data></wddxPacket>

目录