是否可以通过其他方式从SoapVar
输出相应的XML字符串?
例如:
class Security {
public $UsernameToken;
public function __construct()
{
$this->UsernameToken = new UsernameToken();
}
}
class UsernameToken {
public $Username = 'foo';
public $Password = 'bar';
};
$soapVar = new \SoapVar(
new Security(),
SOAP_ENC_OBJECT
);
从上面的变量$soapVar
中,出于测试目的,我想获取以下原始字符串:
<Security>
<UsernameToken>
<Username>foo</Username>
<Password>bar</Password>
</UsernameToken>
</Security>