PHP Class org\transform\driver\Xml

Datei anzeigen Open project: top-think/thinkphp-extend

Public Methods

Method Description
data2xml ( SimpleXMLElement $xml, mixed $data, string $item = 'item', string $id = 'id' ) : string 数据XML编码
decode ( string $str, boolean $assoc = true, array $config = [] ) : string 解码XML数据
encode ( mixed $data, array $config = [] ) : string 编码XML数据
xml2data ( SimpleXMLElement $xml, array &$data, string $item = 'item', string $id = 'id' ) 数据XML解码

Method Details

data2xml() public static method

数据XML编码
public static data2xml ( SimpleXMLElement $xml, mixed $data, string $item = 'item', string $id = 'id' ) : string
$xml SimpleXMLElement
$data mixed 数据
$item string 数字索引时的节点名称
$id string 数字索引key转换为的属性名
return string

decode() public method

解码XML数据
public decode ( string $str, boolean $assoc = true, array $config = [] ) : string
$str string XML字符串
$assoc boolean 是否转换为数组
$config array 数据配置项
return string 解码后的XML数据

encode() public method

编码XML数据
public encode ( mixed $data, array $config = [] ) : string
$data mixed 被编码的数据
$config array 数据配置项
return string 编码后的XML数据

xml2data() public static method

数据XML解码
public static xml2data ( SimpleXMLElement $xml, array &$data, string $item = 'item', string $id = 'id' )
$xml SimpleXMLElement xml对象
$data array 解码后的数据
$item string 数字索引时的节点名称
$id string 数字索引key转换为的属性名