<bdo id='1xWpJ'></bdo><ul id='1xWpJ'></ul>
    1. <i id='1xWpJ'><tr id='1xWpJ'><dt id='1xWpJ'><q id='1xWpJ'><span id='1xWpJ'><b id='1xWpJ'><form id='1xWpJ'><ins id='1xWpJ'></ins><ul id='1xWpJ'></ul><sub id='1xWpJ'></sub></form><legend id='1xWpJ'></legend><bdo id='1xWpJ'><pre id='1xWpJ'><center id='1xWpJ'></center></pre></bdo></b><th id='1xWpJ'></th></span></q></dt></tr></i><div id='1xWpJ'><tfoot id='1xWpJ'></tfoot><dl id='1xWpJ'><fieldset id='1xWpJ'></fieldset></dl></div>

        <legend id='1xWpJ'><style id='1xWpJ'><dir id='1xWpJ'><q id='1xWpJ'></q></dir></style></legend>

        <small id='1xWpJ'></small><noframes id='1xWpJ'>

        <tfoot id='1xWpJ'></tfoot>

        PHP - 在 PHP 中将 XML 转换为数组 - 在 php 中解析一

        时间:2023-05-22
            <tbody id='JQwXP'></tbody>

          1. <i id='JQwXP'><tr id='JQwXP'><dt id='JQwXP'><q id='JQwXP'><span id='JQwXP'><b id='JQwXP'><form id='JQwXP'><ins id='JQwXP'></ins><ul id='JQwXP'></ul><sub id='JQwXP'></sub></form><legend id='JQwXP'></legend><bdo id='JQwXP'><pre id='JQwXP'><center id='JQwXP'></center></pre></bdo></b><th id='JQwXP'></th></span></q></dt></tr></i><div id='JQwXP'><tfoot id='JQwXP'></tfoot><dl id='JQwXP'><fieldset id='JQwXP'></fieldset></dl></div>
            • <bdo id='JQwXP'></bdo><ul id='JQwXP'></ul>
              <legend id='JQwXP'><style id='JQwXP'><dir id='JQwXP'><q id='JQwXP'></q></dir></style></legend>

              • <small id='JQwXP'></small><noframes id='JQwXP'>

                <tfoot id='JQwXP'></tfoot>

                  本文介绍了PHP - 在 PHP 中将 XML 转换为数组 - 在 php 中解析一个 soap xml 并将其存储在数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我想转换一个soap xml 响应并将其存储在数据库中.这是我拥有的 XML.

                  I want to convert a soap xml response and store it in a database. Here is the XML that I have.

                  <ENV:Envelope xmlns:ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://example.com/soap/example">
                     <ENV:Body>
                        <ns1:GetCentresResponse>
                           <ExampleCentre>
                              <ns1:Cent>
                                 <ID>200</ID>
                                 <Name>example2</Name>
                                 <Code>ex2</Code>
                                 <Email>example2@example2.com</Email>
                                 <Address1>example2, example2 </Address1>
                                 <Address2>example2, example2 </Address2>
                                 <City>example2</City>
                                 <PostCode>111111</PostCode>
                                 <Telephone>1111111111</Telephone>
                                 <Location>11.11,-11.11</Location>
                                 <URL>/example2/exam2/ex2</URL>
                              </ns1:Cent>
                           </ExampleCentre>
                        </ns1:GetCentresResponse>
                     </ENV:Body>
                  </ENV:Envelope>
                  

                  我从服务器得到这个soap响应.我想将其转换为数组并将其存储在数据库中.我该怎么办?我知道答案可能很简单,但是嘿,我是新手 :D

                  I get this soap response from the server. I want to convert this to a array and store it in database. What should I do? I know the answer might be pretty straight forward, but hey, am a newbie :D

                  非常感谢我得到的任何帮助.

                  Would really appreciate any help I get.

                  谢谢你的期待.

                  问候

                  推荐答案

                  最好的解决方案是使用 PHP 的 SoapClient 类进行调用,该类将返回一个对象,然后将该对象转换为数组,如下所示:

                  The best solution would be to use PHP's SoapClient class to do the call which will return you an object and then converting this object to an array, like so:

                  <?php
                  $client = new SoapClient("http://localhost/code/soap.wsdl");
                  
                  // Soap call with HelloWorld() method
                  $something =  $client->HelloWorld(array('option1' => 'attribute1'));
                  
                  // Convert object to array
                  $array = (array)$something;
                  
                  ?>
                  

                  然后您可以将其存储在数据库中.

                  Which you can then store in the database.

                  这篇关于PHP - 在 PHP 中将 XML 转换为数组 - 在 php 中解析一个 soap xml 并将其存储在数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:克服 PHP、SoapServer、UTF-8 和非英文字符的编码问题 下一篇:无法在 Yii2 中将肥皂响应字符串转换为 xml

                  相关文章

                  最新文章

                  <i id='uEDEe'><tr id='uEDEe'><dt id='uEDEe'><q id='uEDEe'><span id='uEDEe'><b id='uEDEe'><form id='uEDEe'><ins id='uEDEe'></ins><ul id='uEDEe'></ul><sub id='uEDEe'></sub></form><legend id='uEDEe'></legend><bdo id='uEDEe'><pre id='uEDEe'><center id='uEDEe'></center></pre></bdo></b><th id='uEDEe'></th></span></q></dt></tr></i><div id='uEDEe'><tfoot id='uEDEe'></tfoot><dl id='uEDEe'><fieldset id='uEDEe'></fieldset></dl></div>

                  1. <tfoot id='uEDEe'></tfoot>
                    <legend id='uEDEe'><style id='uEDEe'><dir id='uEDEe'><q id='uEDEe'></q></dir></style></legend>

                    <small id='uEDEe'></small><noframes id='uEDEe'>

                        <bdo id='uEDEe'></bdo><ul id='uEDEe'></ul>