繁体   English   中英

如何使用 php-soap 同时获取具有属性和文本内容的 xml-node 作为子节点?

[英]How to get xml-node with attributes and text content as child at same time with php-soap?

尝试使用 php-soap 为外部 Web 服务生成 xml 请求。

通过服务的 api 我应该传递节点的属性和文本值:

<Volume type="I" determiningMethod="N">192</Volume>

怎么做?

当我像这样传递 assoc-array 时:

Volume => [type=>"I",determiningMethod=>"N"]

我得到:

<Volume type="I" determiningMethod="N"/>

当然,如果我试试这个

Volume => 192

我得到:

<Volume>192</Volume>

但我两者都需要

感谢 @giulp 指向 SoapParam。

根据此评论

如果你需要这样的字符串:

<Volume type="I" determiningMethod="N">192</Volume>

你应该像这样传递数组:

Volume => ['_' => 192, 'type'=>'I', 'determiningMethod'=>'N']

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM