PHP SOAP服务器使用NuSOAP库返回2D数组

时间:2014-05-06 22:49:21

标签: php arrays nusoap

我厌倦了尝试将以下代码转换为2D数组, 但我不能......

    $server->wsdl->addComplexType("ArrayOfString", 
                 "complexType", 
                 "array", 
                 "", 
                 "SOAP-ENC:Array", 
                 array(), 
                 array(array("ref"=>"SOAP-ENC:arrayType","wsdl:arrayType"=>"xsd:string[]")), 
                 "xsd:string");

$server->wsdl->addComplexType("ArrayOf2D", 
                 "complexType", 
                 "array", 
                 "", 
                 "SOAP-ENC:Array", 
                 array(), 
                 array(array("ref"=>"SOAP-ENC:arrayType","wsdl:arrayType"=>"tns:ArrayOfString[]")), 
                 "tns:ArrayOfString");


$server->register('myfunc',  // method name
        array(),  //input
        array('return'=>'tns:ArrayOf2D'),  //output
        'urn:hellowsdl' ,  // namespace
        'urn:hellowsdl#hello',  // soapaction
        'rpc',  // style
        'encoded',  // use
        'Say hello to the caller'  // documentation
        );

function myfunc() {
    $arr = array();
    array_push( $arr, array("a","s","d") );
    array_push( $arr, array("t","y","u") );
    return $arr;
}

0 个答案:

没有答案