PHP 手册
上一页 |  | 下一页

# SoapServer->addFunction()

(no version information, might be only in CVS)

SoapServer->addFunction() -- Adds one or several functions those will handle SOAP requests

## 说明

class SoapServer {
void addFunction ( mixed functions )
}

Exports one or more functions for remote clients.

## 参数

`functions`

  To export one function, pass the function name into this parameter as a string.

  To export several functions, pass an array of function names.

  To export all the functions, pass a special constant `SOAP_FUNCTIONS_ALL`.

  > 注意: `functions` must receive all input arguments in the same order as defined in the WSDL file (They should not receive any output parameters as arguments) and return one or more values. To return several values they must return an array with named output parameters.

## 返回值

无返回值。

## 范例

例 1. Some examples

`<?php function echoString($inputString) { return $inputString; } $server->addFunction("echoString"); function echoTwoStrings($inputString1, $inputString2) { return array("outputString1" => $inputString1, "outputString2" => $inputString2); } $server->addFunction(array("echoString", "echoTwoStrings")); $server->addFunction(SOAP_FUNCTIONS_ALL); ?>`

## 参见

SoapServer->__construct()
SoapServer->setClass()

上一页 | 起始页 | 下一页
SoapParam->__construct() | 上一级 | SoapServer->__construct()