[英]Get XML attribute name (not value) using PHP
<Parent>
<Children idontknowthis='thisisnotmyquestion'>
<x>1</x>
<x>2</x>
<x>3</x>
<x>4</x>
</Children>
</Parent>
下面是我正在使用的.xml文件示例。 我的腳本需要自行建立“ id”(要清楚我已經可以使用bk109了)...
<book id="bk109">
<author>Kress, Peter</author>
<title>Paradox Lost</title>
<genre>Science Fiction</genre>
<price>6.95</price>
<publish_date>2000-11-02</publish_date>
<description>After an inadvertant trip through a Heisenberg
Uncertainty Device, James Salway discovers the problems
of being quantum.</description>
</book>
出於PHP中XML導入腳本的目的,它將導入許多不同的XML文件。 如何獲取屬性名稱? (即“ id”)
使用SimpleXML的attributes
屬性。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.