PHP code example of houdunwang / xml
1. Go to this page and download the library: Download houdunwang/xml library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
houdunwang / xml example snippets
$data = array(
'@attributes' => array(
'type' => 'fiction'
),
'book' => array(
array(
'@attributes' => array(
'author' => 'houdunwang.com'
),
'title' => 'houdunwang'
),
array(
'@attributes' => array(
'author' => 'hdcms'
),
'title' => array( '@cdata' => 'version' ),
'price' => '$998'
)
)
);
header( 'Content-Type: application/xml' );
$xml = Xml::toXml('root_node', $data);
echo $xml;