本文整理汇总了PHP中Zend_XmlRpc_Server::addFunction方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_XmlRpc_Server::addFunction方法的具体用法?PHP Zend_XmlRpc_Server::addFunction怎么用?PHP Zend_XmlRpc_Server::addFunction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_XmlRpc_Server
的用法示例。
在下文中一共展示了Zend_XmlRpc_Server::addFunction方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFunctions
/**
* get/loadFunctions() test
*/
public function testFunctions()
{
try {
$this->_server->addFunction(array('Zend_XmlRpc_Server_testFunction', 'Zend_XmlRpc_Server_testFunction2'), 'zsr');
} catch (Exception $e) {
$this->fail('Error attaching functions: ' . $e->getMessage());
}
$expected = $this->_server->listMethods();
$functions = $this->_server->getFunctions();
$server = new Zend_XmlRpc_Server();
$server->loadFunctions($functions);
$actual = $server->listMethods();
$this->assertSame($expected, $actual);
}
示例2: testHandleFunction
public function testHandleFunction()
{
$this->_server->addFunction('Zend_XmlRpc_Server_testFunction');
$request = new Zend_XmlRpc_Request();
$request->setMethod('Zend_XmlRpc_Server_testFunction');
$request->setParams(array(array('value1'), 'key'));
$response = $this->_server->handle($request);
$this->assertEquals('key: value1', $response->getReturnValue());
}
示例3: testHandleFunction
public function testHandleFunction()
{
$this->_server->addFunction('ZendTest\\XmlRpc\\testFunction');
$request = new Request();
$request->setMethod('ZendTest\\XmlRpc\\testFunction');
$request->setParams(array(array('value1'), 'key'));
$response = $this->_server->handle($request);
$this->assertFalse($response instanceof Fault);
$this->assertEquals('key: value1', $response->getReturnValue());
}
示例4: login
* @return boolean true on success, else false.
*/
function login($username, $password)
{
$h = new MailboxHandler();
if ($h->login($username, $password)) {
session_regenerate_id();
$_SESSION['authenticated'] = true;
$_SESSION['sessid'] = array();
$_SESSION['sessid']['username'] = $username;
return true;
}
return false;
}
if (!isset($_SESSION['authenticated'])) {
$server->addFunction('login', 'login');
} else {
$server->setClass('UserProxy', 'user');
$server->setClass('VacationProxy', 'vacation');
$server->setClass('AliasProxy', 'alias');
}
echo $server->handle();
class UserProxy
{
/**
* @param string $old_password
* @param string $new_password
* @return boolean true on success
*/
public function changePassword($old_password, $new_password)
{
示例5: getPhpInfo
<?php
error_reporting(E_ALL & ~E_WARNING);
ini_set('display_errors', true);
require_once 'Zend/XmlRpc/Server.php';
$server = new Zend_XmlRpc_Server();
$server->addFunction('getPhpInfo');
echo $server->handle();
/**
* @return string
*/
function getPhpInfo()
{
return file_get_contents('./phpinfo.html');
}