php soap对象数组

在实现某个soap的时候遇到了点麻烦,实在无解,求问:

soap要求参数格式

<fieldList>
    <KeyValue>
        <Key>string</Key>
        <Value>string</Value>
    </KeyValue>
    <KeyValue>
        <Key>string</Key>
        <Value>string</Value>
    </KeyValue>
</fieldList>

实际PHP需要这样实现:

array (
    'filedlit' => array (
            'keyvalue' => array (
                    'key' => 'a1sd',
                    'value' => 'asd' 
            ),
            'keyvalue' => array (
                    'key' => 'as2d',
                    'value' => 'asd' 
            ),
            'keyvalue' => array (
                    'key' => 'as3d',
                    'value' => 'asd' 
            ),
            'keyvalue' => array (
                    'key' => 'as4d',
                    'value' => 'asd' 
            ),
            'keyvalue' => array (
                    'key' => 'asd',
                    'value' => 'asd' 
            ),
            'keyvalue' => array (
                    'key' => 'asd',
                    'value' => 'asd' 
            ) 
    )

);

当然我也构建了 obj版

array('listfiled'=>array (
            new KeyValue ( 'asd', 'ccccc' ),
            new KeyValue ( 'asd', 'ccccc' ),
            new KeyValue ( 'asd', 'ccccc' ),
            new KeyValue ( 'asd', 'ccccc' ),
            new KeyValue ( 'asd', 'ccccc' )
));

obj版本服务器无法识别,求解

阅读 3.2k
1 个回答

生成xml格式

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题