我猜 NameSpaces 导致simplexml_load_string
无法正常工作,但我绝对不确定。
日志.xml
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sns="http://soap.com/pbx">
<env:Body>
<sns:CDR>
<PrimaryCallID>02v7b7c16v@12.123.123.12</PrimaryCallID>
<CallID>d352f920@pbx</CallID>
<From>"SMITH JOHN " <sip:11234567890@sub.domain.com:5060;user=phone></From>
<To><sip:3216549870@111.111.111.111:5060;user=phone></To>
<Direction>O</Direction>
<Type>attendant</Type>
<RemoteParty />
<LocalParty />
<TrunkName />
... more xml...
</sns:CDR>
</env:Body>
</env:Envelope>
解析.php
<?php
$string = "log.xml";
$xml = simplexml_load_string($string);
print_r($xml);
?>
我没有从print_r
我错过了什么?