wddx 为全球信息网分散式文件交换,全名为 web distributed data exchange。其实 wddx 可以算是 xml 的一个分支。更多有关 wddx 的信息可以参考 http://www.wddx.org。
例一: 本例将单一值连续化
<?php
print wddx_serialize_value("php to wddx packet example", "php packet");
?>
返回到浏览器的资料为
<wddxpacket version='0.9'><header comment='php packet'/><data>
<string>php to wddx packet example</string></data></wddxpacket>
例二: 本例将 wddx 封包加入资料
<?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 htmlentities($packet);
?>
返回到浏览器的资料为
<wddxpacket version='0.9'><header comment='php'/><data><struct>
<var name='pi'><number>3.1415926</number></var><var name='cities'>
<array length='3'><string>aust
| 对此文章发表了评论 |
