News新闻

业界新闻动态、技术前沿
Who are we?

您的位置:首页      乐道系统FAQ      PHP输出XML格式数据的方法总结

PHP输出XML格式数据的方法总结

发布日期:2017-02-08 00:00:00 75

本文实例讲述了PHP输出XML格式数据的方法。分享给大家供大家参考,具体如下:

方法1:

<?php
header("Content-type: text/xml");
echo "<?xml version='1.0' encoding='UTF-8'?>";
echo "<users>";
echo "<user>";
  echo "<name>";
  echo "小小菜鸟";
  echo "</name>";
  echo "<age>";
  echo "24";
  echo "</age>";
  echo "<sex>";
  echo "男";
  echo "</sex>";
echo "</user>";
echo "<user>";
  echo "<name>";
  echo "艳艳";
  echo "</name>";
  echo "<age>";
  echo "23";
  echo "</age>";
  echo "<sex>";
  echo "女";
  echo "</sex>";
echo "</user>";
echo "</users>";
?>