Welcome to the Cookbook

loading...

7.12.3 header

There is no translation yet for this section. Please help out and translate this.. More information about translations

The header() method is used to output the XML declaration.

<?php
echo $xml->header(); 
// generates: <?xml version="1.0" encoding="UTF-8" ?>
?>
  1. <?php
  2. echo $xml->header();
  3. // generates: <?xml version="1.0" encoding="UTF-8" ?>
  4. ?>

You can pass in a different version number and encoding type as parameters of the header method.

<?php
echo $xml->header(array('version'=>'1.1')); 
// generates: <?xml version="1.1" encoding="UTF-8" ?>
?>
  1. <?php
  2. echo $xml->header(array('version'=>'1.1'));
  3. // generates: <?xml version="1.1" encoding="UTF-8" ?>
  4. ?>