php simpleXML_load_string报错,哪位高手会啊??
<?php$string=<<<XML<?xmlversion='1.0'?><documemt><title>FortyWhat?</title><from>Joe</...
<?php
$string = <<<XML
<?xml version='1.0'?>
<documemt>
<title>Forty What?</title>
<from>Joe</from>
<to>Jane</to>
<body>
I know that's the answer -- but what's the question?
</body>
</document>
XML;
$xml = simplexml_load_string($string);
foreach($xml->xpath("//title") as $title){
echo "<br>".$title;
}
print_r($xml);
?>
报错信息:
Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Blank needed here in D:\myPHP\Apache2.2\htdocs\XML\simpleXML\simpleXML2.php on line 14
Warning: simplexml_load_string() [function.simplexml-load-string]: <?xml version='1.0'?> in D:\myPHP\Apache2.2\htdocs\XML\simpleXML\simpleXML2.php on line 14 展开
$string = <<<XML
<?xml version='1.0'?>
<documemt>
<title>Forty What?</title>
<from>Joe</from>
<to>Jane</to>
<body>
I know that's the answer -- but what's the question?
</body>
</document>
XML;
$xml = simplexml_load_string($string);
foreach($xml->xpath("//title") as $title){
echo "<br>".$title;
}
print_r($xml);
?>
报错信息:
Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Blank needed here in D:\myPHP\Apache2.2\htdocs\XML\simpleXML\simpleXML2.php on line 14
Warning: simplexml_load_string() [function.simplexml-load-string]: <?xml version='1.0'?> in D:\myPHP\Apache2.2\htdocs\XML\simpleXML\simpleXML2.php on line 14 展开
1个回答
推荐于2016-11-29
展开全部
<?php
$string = <<<XML
<?xml version="1.0"?>
<document>
<title>Forty What?</title>
<from>Joe</from>
<to>Jane</to>
<body>
I know that's the answer -- but what's the question?
</body>
</document>
XML;
$xml = simplexml_load_string($string);
foreach($xml->xpath("//title") as $title){
echo "<br>".$title;
}
print_r($xml);
?>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询