Home >Backend Development >PHP Tutorial >How to output xml attributes in php_PHP tutorial
This article mainly introduces the method of PHP outputting XML attributes. It analyzes the usage skills of PHP's method of operating XML file attributes with an example, which has certain reference. For reference value, friends in need can refer to it
The example in this article describes how php outputs xml attributes. Share it with everyone for your reference. The specific analysis is as follows:
This code demonstrates through a simple example how PHP reads an xml file and outputs xml attributes
?
3 4
5
6
|
$xml = simplexml_load_file("books.xml"); foreach($xml->book[0]->author->attributes() AS $a => $b) { echo "$a = $b";
|
1 |
|