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

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

        将数组传递给 PHP 中的 SOAP 函数

        时间:2023-05-22
        • <legend id='KljD8'><style id='KljD8'><dir id='KljD8'><q id='KljD8'></q></dir></style></legend>

          1. <tfoot id='KljD8'></tfoot>
            • <bdo id='KljD8'></bdo><ul id='KljD8'></ul>

                    <tbody id='KljD8'></tbody>

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

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

                  本文介绍了将数组传递给 PHP 中的 SOAP 函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  您好,

                  我似乎找不到以数组为参数创建函数请求的方法.例如,我如何使用 PHP SoapClient 发出这种请求:

                  I can't seem to find a way to create a function request with array as an argument. For example, how do I make this kind of request using PHP SoapClient:

                  <GetResultList>
                    <GetResultListRequest>
                      <Filters>
                        <Filter>
                          <Name>string</Name>
                          <Value>string</Value>
                        </Filter>
                        <Filter>
                          <Name>string</Name>
                          <Value>string</Value>
                        </Filter>
                      </Filters>
                    </GetResultListRequest>
                  </GetResultList>
                  

                  是否可以在不创建任何额外类的情况下调用此函数(仅使用数组)?如果不是,最简洁的调用方式是什么?

                  Is this possible to call this function without creating any extra classes (using arrays only)? If no, what is the most compact way of calling it?

                  推荐答案

                  您可以使用这个 -v 函数将数组转换为对象树:

                  You can use this -v function to convert a array to a object tree:

                  function array_to_objecttree($array) {
                    if (is_numeric(key($array))) { // Because Filters->Filter should be an array
                      foreach ($array as $key => $value) {
                        $array[$key] = array_to_objecttree($value);
                      }
                      return $array;
                    }
                    $Object = new stdClass;
                    foreach ($array as $key => $value) {
                      if (is_array($value)) {
                        $Object->$key = array_to_objecttree($value);
                      }  else {
                        $Object->$key = $value;
                      }
                    }
                    return $Object;
                  }
                  

                  像这样:

                  $data = array(
                    'GetResultListRequest' => array(
                      'Filters' => array(
                        'Filter' => array(
                          array('Name' => 'string', 'Value' => 'string'), // Has a numeric key
                          array('Name' => 'string', 'Value' => 'string'),
                        )
                      )
                    )
                  );
                  $Request = array_to_objecttree($data);
                  

                  这篇关于将数组传递给 PHP 中的 SOAP 函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:带有 SSL 证书的 PHP SOAP 客户端 下一篇:“未将对象引用设置为对象的实例"从 PHP 连接

                  相关文章

                  最新文章

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

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

                    <tfoot id='ScxdO'></tfoot><legend id='ScxdO'><style id='ScxdO'><dir id='ScxdO'><q id='ScxdO'></q></dir></style></legend>

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