Heim >Backend-Entwicklung >PHP-Tutorial >php读取xml节点值,该如何处理
php读取xml节点值
获取的XML如下:
<br /><?xml version="1.0" encoding="utf-8"?><br /><string xmlns="SuperMarketService">{"status":"failed","result":"未知错误"}</string><br />
header('Content-type: text/html;charset=utf-8');{"status":"failed","result":"未知错误"}
$s =<<< XML<br /><?xml version="1.0" encoding="utf-8"?><br /><string xmlns="SuperMarketService">{"status":"failed","result":"未知错误"}</string><br />XML;
$x = @simplexml_load_string($s);
echo $x[0];