Ref/wddx-Phpdoc专题

wddx_add_vars

Add variables to a WDDX packet with the specified ID

Warning

该函数已在 PHP 7.4.0 中 移除

说明

bool <span class="methodname">wddx_add_vars ( <span class="methodparam">resource $packet_id , <span class="type">mixed $var_name , <span class="methodparam">mixed $var_names )

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 <span class="function">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.

var_names

返回值

成功时返回 true, 或者在失败时返回 false

wddx_deserialize

Unserializes a WDDX packet

Warning

该函数已在 PHP 7.4.0 中 移除

说明

mixed <span class="methodname">wddx_deserialize ( <span class="methodparam">string $packet )

Unserializes a WDDX packet.

Warning

Do not pass untrusted user input to <span class="function">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 <span class="function">json_decode and <span class="function">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

该函数已在 PHP 7.4.0 中 移除

说明

string <span class="methodname">wddx_packet_end ( <span class="methodparam">resource $packet_id )

Ends and returns the given WDDX packet.

参数

packet_id
A WDDX packet, returned by <span class="function">wddx_packet_start.

返回值

Returns the string containing the WDDX packet.

wddx_packet_start

Starts a new WDDX packet with structure inside it

Warning

该函数已在 PHP 7.4.0 中 移除

说明

resource <span class="methodname">wddx_packet_start ([ <span class="methodparam">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

该函数已在 PHP 7.4.0 中 移除

说明

string <span class="methodname">wddx_serialize_value ( <span class="methodparam">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

该函数已在 PHP 7.4.0 中 移除

说明

string <span class="methodname">wddx_serialize_vars ( <span class="methodparam">mixed $var_name , mixed $var_names )

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.

var_names

返回值

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>

目录


本站为非盈利网站,作品由网友提供上传,如无意中有侵犯您的版权,请联系删除