Home >Backend Development >PHP Tutorial >persistence.xml PHP XML data parsing code
Copy the code The code is as follows:
//xml string
$xml_string="
//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, '
';
}
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.