複製程式碼 程式碼如下:
//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)
{
foreach ($xml->user as $user)
{
{
/> /access attribute
echo $user['id'], ' ';
//subnodes are accessed by -> operator
echo $user->name, ' ';
以上就介紹了persistence.xml PHP XML資料解析程式碼,包含了persistence.xml方面的內容,希望對PHP教學有興趣的朋友有幫助。