使用simplexml_load_string解析這段XML報錯。
$data = <<<XML
<ROOT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="JobSendedDescription">
<RetCode>Sucess</RetCode>
<JobID>183372602</JobID>
<OKPhoneCounts>1</OKPhoneCounts>
<StockReduced>1</StockReduced>
<ErrPhones />
</ROOT>
XML;
$xml = simplexml_load_string($data);
var_dump($xml);
報錯內(nèi)容是警告級別的,報錯內(nèi)容如下
Warning: simplexml_load_string(): namespace warning : xmlns: URI JobSendedDescription is not absolute in D:\laragon\www\index.php on line 11
Warning: simplexml_load_string(): tance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="JobSendedDescription" in D:\laragon\www\index.php on line 11
Warning: simplexml_load_string(): ^ in D:\laragon\www\index.php on line 11
我把xmlns="JobSendedDescription"改成xmlns:URI="JobSendedDescription",警告級別報錯就消除了,請問是這段XML語法有問題還是simplexml_load_string解析不了這種XML?
使用simplexml_load_string解析這段XML報警告級別錯誤,請問是什么引起的?
料青山看我應(yīng)如是
2019-03-08 15:38:19