我想傳遞一個XML字符串到一個函數,然後我會返回父節點連同它的值。傳遞XML到PHP函數
說了一個例子:
$xml = "<Student><Name>Jee Pee</Name><Age>16</Age></Student>";
runXmltoStr($xml);
function runXmltoStr($xml)
{
// This is where I can't figure out where to start
// In my mind, I do have this output
//
// Student
// Name: Jee Pee
// Age: 16
}
首先閱讀PHP XML解析器:http://php.net/manual/en/book.xml.php – ChrisW 2011-12-17 17:32:37
感謝Chris的鏈接。 – 2011-12-17 17:34:44