在 PHP 中创建在 WSDL 文件中定义的类的实例
我正在使用 PHP 中的 WSDL 和默认的 SoapClient 对象。在该 WSDL 内部定义了一个名为“Favorite”的对象,它有 5 个成员。有没有一种方法可以在 PHP 中创建该类的实例,因为该 WSDL 的某些方法要求我将该对象传递给它。我尝试过:
$favorite = new favorite();
在我学习了 WSDL 之后,但这不起作用。
I am consuming a WSDL in PHP with the default SoapClient object. Inside that WSDL is defines an object called Favorite that has 5 members. Is there a way I can create and instance of the class in PHP as some fo the method of that WSDL required me to pass that object to it. I have tried:
$favorite = new Favorite();
after I have comsumed the WSDL but that did not work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能直接创建该类。通常,您只需创建一个具有对象正确属性的关联数组,PHP SoapClient 将完成剩下的工作。否则,请使用 SoapVar:
You can't create the class directly. Usually, you can simply create an associative array with the correct properties for the object and the PHP SoapClient will do the rest. Otherwise, use SoapVar: