簡體   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