ฉันมีสิ่งต่อไปนี้ส่งคืนเป็น XML จากแหล่งที่มา:
<content type="application/xml">
<m:properties>
<d:ID>30</d:ID>
<d:Name></d:Name>
<d:ProfileImageUrl>default.png</d:ProfileImageUrl>
<d:ThumbnailUrl>default.png</d:ThumbnailUrl>
<d:FavoriteCount m:type="Edm.Int64">0</d:FavoriteCount>
<d:ViewCount m:type="Edm.Int64">12030</d:ViewCount>
<d:LastMonthViewCount m:type="Edm.Int64">1104</d:LastMonthViewCount>
<d:LastWeekViewCount m:type="Edm.Int64">250</d:LastWeekViewCount>
<d:LastDayViewCount m:type="Edm.Int64">21</d:LastDayViewCount>
<d:CreationDate m:type="Edm.DateTime">2011-03-28T13:46:54.227</d:CreationDate>
<d:Enabled m:type="Edm.Boolean">true</d:Enabled>
<d:UrlSafeName>t-boz</d:UrlSafeName>
<d:LastDayFavoriteCount m:type="Edm.Int64">0</d:LastDayFavoriteCount>
<d:LastWeekFavoriteCount m:type="Edm.Int64">0</d:LastWeekFavoriteCount>
<d:LastMonthFavoriteCount m:type="Edm.Int64">0</d:LastMonthFavoriteCount>
<d:IsOnTour m:type="Edm.Boolean">false</d:IsOnTour>
<d:TodayRank m:type="Edm.Int32">6272</d:TodayRank>
<d:WeekRank m:type="Edm.Int32">6851</d:WeekRank>
<d:MonthRank m:type="Edm.Int32">6915</d:MonthRank>
<d:AllTimeRank m:type="Edm.Int32">7973</d:AllTimeRank>
</m:properties>
</content>
ฉันกำลังดึงข้อมูลนี้ผ่าน file_get_contents จากนั้นสร้างผ่าน SIMPLEXMLElement อย่างไรก็ตาม ฉันไม่สามารถเข้าถึงฟิลด์เนื้อหา -> คุณสมบัติ (เช่น ID, ชื่อ, ProfileImageUrl ฯลฯ ) ทั้งหมดที่ฉันเห็นจาก SIMPLEXMLElement มีดังต่อไปนี้:
[content] => SimpleXMLElement Object ( [@attributes] => Array ( [type] => application/xml ) )
มีความคิดเห็นเกี่ยวกับวิธีที่ฉันรับข้อมูลนี้หรือไม่
ขอบคุณ!
m
และd
ในเอกสาร - person salathe   schedule 01.03.2012