PHP & XML How to display data
I'm not very exper开发者_如何转开发ienced when it comes to XML, I'm looking for a simple php code that can display certain information from an XML file. This file to be exact:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<TITLE>THIS</TITLE>
<TITLE2>THIS AGAIN</TITLE2>
</Response>
Any help would be great, Thanks!
(P.S I just want to simply echo the 2 fields out)
Take a look at simplexml, it's pretty easy and straight forward!
Your example would look like this:
$xml = simplexml_load_string($xml_string);
echo $xml->title;
echo $xml->title2;
精彩评论