Foo foo@bar.com Foo foo@bar.com

Home >Backend Development >PHP Tutorial >persistence.xml PHP XML data parsing code

persistence.xml PHP XML data parsing code

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-29 08:42:551171browse

Copy the code The code is as follows:


//xml string
$xml_string="


Foo< ;/name>
foo@bar.com



Foobar
foobar@foo.com< /name>

";
//load the xml string using simplexml
$xml = simplexml_load_string($xml_string);
//loop through the each node of user
foreach ($ xml->user as $user)
{
//access attribute
echo $user['id'], ' ';
//subnodes are accessed by -> operator
echo $user->name, ' ';
echo $user->email, '
';
}


This is an excerpt from a previously published article on this site. You can refer to more tips.
Collection of twenty-one practical and convenient PHP function codes

The above introduces the persistence.xml PHP XML data parsing code, including the content of persistence.xml. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn