PHP simplexml 使用方法详解
本文章给来大家讲一下关于
PHP 下 simplexml 使用方法,希望通过此文章能提升大家对
simplexml 操作 xml 文档的理解,有需要了解的朋友可参考。
PHP XML 处理 XML 代码如下
<?xml version="1.0" encoding="UTF-8"?>
<!-- Edited with XML Spy v2007 (http://www.altova.com) -->
<breakfast_menu>
<food id="1">
<name>Belgian Waffles</name>
<price>$5.95</price>
<description>two of our famous Belgian Waffles with plenty of real maple syrup</description>
<calories>650</calories>
</food>
<food id="2">
<name>Strawberry Belgian Waffles</name>
<price>$7.95</price>
<description>light Belgian waffles covered with strawberries and whipped cream</description>
<calories>900</calories>
</food>
<food id="3">
<name>Berry-Berry Belgian Waffles</name>
<price>$8.95</price>
<description>light Belgian waffles covered with an assortment of fresh berries and whipped
cream</description>
<calories>900</calories>
</food>
</breakfast_menu>
php 解决 xml 代码
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>使用 simpleXML 处理 XML</title>
</head>
<body>
<table border="1" cellpadding="0" cellspacing="0" width="700">
</tbody>
<tr bgcolor="green">
<th width="5%"> </th>
<th width="20%">name</th>
<th width="10%">price</th>
<th width="55%">description</th>