SoapServer::addFunction - Adds one or more functions to handle SOAP requests
Вернуться к: SoapServer
SoapServer::addFunction
(PHP 5 >= 5.0.1, PHP 7)
SoapServer::addFunction — Adds one or more functions to handle SOAP requests
Описание
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 SoapServer::addFunction() example
<?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::SoapServer() - SoapServer constructor
- SoapServer::setClass() - Устанавливает класс, который будет обрабатывать SOAP-запросы
Вернуться к: SoapServer