美文网首页
php 解析 xml

php 解析 xml

作者: 花钱约下 | 来源:发表于2018-11-22 17:44 被阅读0次
    $xmlStr = <<<XML
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <soap:Body>
            <client_insetResponse xmlns="http://127.0.0.1/webservices/">
                <client_insetResult>0|</client_insetResult>
            </client_insetResponse>
        </soap:Body>
    </soap:Envelope>
    XML;
    
    $xmlObj = simplexml_load_string($xmlStr);
    $xmlObj->registerXPathNamespace('soap', 'http://schemas.xmlsoap.org/soap/envelope/');
    $result = $xmlObj->xpath("soap:Body");
    
    print_r($result);
    

    相关文章

      网友评论

          本文标题:php 解析 xml

          本文链接:https://www.haomeiwen.com/subject/kpfrqqtx.html