2
<data>
<gig id="1">
<date>December 19th</date>
<venue>The Zanzibar</venue>
<area>Liverpool</area>
<telephone>Ticketline.co.uk</telephone>
<price>£6</price>
<time>Time TBA</time>
</gig>
<gig id="2">
<date>Sat. 16th Jan</date>
<venue>Celtic Connection, Classic Grand</venue>
<area>Glasgow</area>
<telephone>0141 353 8000</telephone>
<price>£17.50</price>
<time>7pm</time>
</gig>
说如果我想从具有2属性的gig元素中查看“date”的值我怎么能使用php做到这一点?寻找一个特定属性的儿童的价值
基本上我想删除say id 2然后重新创建它或者只是修改它。
使用simpleXML我该如何删除某个部分?
我不断收到这个错误致命错误:调用第45行的/var/www/sm16832/public_html/cms/index.php中非对象的成员函数xpath() – 2010-01-20 10:48:29
在本例中,$ data是你的SimpleXMLElement对象。为了避免混淆,*总是*在您所代表的节点之后命名您的PHP变量。如果根节点是'',那么你的PHP变量应该是'$ data'。 – 2010-01-20 11:19:48