-1
我有一個XML文件爲我的項目幹活需要從XML文件。該文件讀取數據中包含類似以下內容:XML數據獲取幫助需要
<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:szgd="http://www.spotzot.com/gdfeed" xmlns:szbb="http://www.spotzot.com/bbfeed">
<channel>
<item>
<title>Service & Maintenance under $50</title>
<description>7 Items | Prestone, Campbell Hausfeld, Custom Accessories, Custom, KD Tools</description>
<szgd:instore>Y</szgd:instore>
</item>
</channel>
</rss>
我使用$newtitle=$newxml->channel->item->title;
獲取數據來自title.It成功返回標題。
如何使用php從我的頁面中的標記獲取數據?
你問哪個標籤? – Khushboo 2014-10-16 11:07:18
你是如何加載'$ newxml'的? – Peter 2014-10-16 11:42:29
我剛剛解決it.with $ newxml-> channel-> item-> children('http://www.spotzot.com/gdfeed') - > instore。這裏children()中的鏈接是szgd的值,它定義在xml的頂部。 – 2014-10-16 12:29:07