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