【问题标题】:Zend_Soap : How to define return type struct in doc block?Zend_Soap:如何在文档块中定义返回类型结构?
【发布时间】:2010-09-29 17:30:41
【问题描述】:

我有一个使用 Zend_Soap 设置的 Web 服务,以及该 Web 服务中的一些公共方法。 事实是我想返回一个复杂的类型。

例如,如果我想返回一个二维数组,比如一个表的行集,我应该如何指定 doc 块? 这是我的案例之一。我想返回一个数组,每个元素都有一个 int 和两个字符串。喜欢:

[0] = {1 , NameA, StringA }
[1] = {4 , NameB, StringB }
[2] = {6 , NameC, StringC }
[3] = {9 , NameD, StringD }

我怎样才能做到这一点? 那么我怎样才能让第三个字段变得更复杂,比如用另一个 int 和 string 数组替换第三个字段?

TIA

【问题讨论】:

    标签: arrays zend-framework soap struct zend-soap


    【解决方案1】:

    使用 Zend_Soap_AutoDiscover http://framework.zend.com/manual/en/zend.soap.autodiscovery.html

    你只需要定义你的复杂类型

    class complexType {
    /*put your definitions of class here*/
    
    }
    

    像这样放在phpdoc中

         /**
         *
         * @param int $id
         * @return complexType
         */
        public function getSomething($id) {
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-03-21
      • 2022-01-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多