(PHP) SoapClient 类的对象无法转换为字符串
这段代码工作正常:
$result = $client->__call("optionalInfo", array(
new SoapParam("...", "client"),
new SoapParam("...", "add_code"))
);
当我尝试对其进行抽象以使脚本可重用时,我收到此错误:
可捕获的致命错误:类 SoapClient 的对象无法转换为字符串
损坏的代码是:
$params = array( new SoapParam($client, "client"),
new SoapParam($add_code, "add_code")
);
$result = $client->__call($functionName, $params);
最后一行是什么导致问题。
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
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您确定要将 SoapClient 接口作为参数发送到同一对象上的函数调用吗?
Are you sure you want to send the SoapClient interface as an argument to a function call on the same object?