PHP traversal parsing XML string method, PHP parsing XML string
The example in this article describes how PHP iterates through parsing XML strings. Share to everyone for your reference, as follows:
<?php$content = <<
HTTP
/index.html
2
3
XML; $test = new SimpleXMLElement ($content);//Get Ping_protocol value $ping_protocol = $test->global_setting->ping_ Protocol;echo "Ping_protocol: $ping _protocol \ n";//print out all instance Ipforeach ($test->instances->instance as $ Instance) {echo "IP: {$instance [' IP ']} \ n";} Here after testing, found that using var_dump and the like do not seem to be effective output value, with echo more smooth,//And there is the above example of XML can be removed <?xml version= "1.0" encoding= "UTF-8"?>// You can also go to the end of the <<
More interested in PHP related content readers can view the site: "PHP operation tips FOR XML file summary", "PHP date and Time usage summary", " PHP Introduction to Object-oriented programming, "PHP array" Operation tips, "PHP string Usage Summary", "Php+mysql Database Operations Primer" and "PHP Common Database Operations Tips Summary"
I hope this article is helpful to you in PHP programming.
http://www.bkjia.com/phpjc/1123807.html www.bkjia.com true Span id= "Isbasedonurl" itemprop= "Isbasedonurl" >http://www.bkjia.com/phpjc/1123807.html techarticle php traverse parsing xml string, PHP parse XML string The example in this article describes how PHP iterates through parsing XML strings.
Share to everyone for your reference, as follows: Php$conten ...