我想传递一个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