This code works fine:
这段代码工作正常:
$result = $client->__call("optionalInfo", array(
new SoapParam("...", "client"),
new SoapParam("...", "add_code"))
);
When I try abstracting it a bit to make the script re-usable, I get this error:
当我尝试抽象它以使脚本可重用时,我收到此错误:
Catchable fatal error: Object of class SoapClient could not be converted to string
可捕获的致命错误:类SoapClient的对象无法转换为字符串
The broken code is:
破碎的代码是:
$params = array( new SoapParam($client, "client"),
new SoapParam($add_code, "add_code")
);
$result = $client->__call($functionName, $params);
The last line is what is causing the problem.
最后一行是导致问题的原因。
1 个解决方案
#1
Are you sure you want to send the SoapClient interface as an argument to a function call on the same object?
您确定要将SoapClient接口作为参数发送到同一对象上的函数调用吗?
new SoapParam($client, "client")
#1
Are you sure you want to send the SoapClient interface as an argument to a function call on the same object?
您确定要将SoapClient接口作为参数发送到同一对象上的函数调用吗?
new SoapParam($client, "client")