A large number of smiplexml functions can be used to load and parse a large number of XML documents.
--------------------------------------------------------------------------------
1.
simplexml_load_file ()function to load the specified XML file into the object. If you are having trouble loading the file, return flase. Cases:
Book.xml file:
Copy CodeThe code is as follows:
Pride and Prejudice
Jane Austen
Jane Austen ' s most popular work.
The Conformist
Alberto Moravia
Alberto Moravia ' s classic psyhcological novel.
The Sun Also rises
Ernest Hemingway
The masterpiece that launched Hemingway ' s career.
PHP Files:
Copy CodeThe code is as follows:
$xml =simplexml_load_file ("Book.xml"); echo "
";
Var_dump ($xml);
?>
Output Result:
Copy CodeThe code is as follows:
Object (SimpleXMLElement) #1 (1) {
["Book"]=>
Array (3) {
[0]=>
Object (SimpleXMLElement) #2 (3) {
["title"]=>
String ("Pride and Prejudice")
["Author"]=>
String (one) "Jane Austen"
["description"]=>
String (+) "Jane Austen ' s most popular work."
}
[1]=>
Object (SimpleXMLElement) #3 (3) {
["title"]=>
String ("The Conformist")
["Author"]=>
String ("Alberto Moravia")
["description"]=>
String "Alberto Moravia's classic psyhcological novel."
}
[2]=>
Object (SimpleXMLElement) #4 (3) {
["title"]=>
String ("The Sun Also Rises")
["Author"]=>
String (+) "Ernest Hemingway"
["description"]=>
String "The masterpiece that launched Hemingway ' s career."
}
}
}
http://www.bkjia.com/PHPjc/327494.html www.bkjia.com true http://www.bkjia.com/PHPjc/327494.html techarticle a large number of smiplexml functions can be used to load and parse a large number of XML documents. --------------------------------------------------------------------------------1. Simplexml_load_file () function to load ...