本文整理汇总了PHP中Zend_XmlRpc_Request::saveXml方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_XmlRpc_Request::saveXml方法的具体用法?PHP Zend_XmlRpc_Request::saveXml怎么用?PHP Zend_XmlRpc_Request::saveXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_XmlRpc_Request
的用法示例。
在下文中一共展示了Zend_XmlRpc_Request::saveXml方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: serialize
/**
* {@inheritdoc}
*/
public function serialize($method, array $params = [])
{
$toBeVisited = [&$params];
while (isset($toBeVisited[0]) && ($value =& $toBeVisited[0])) {
$type = gettype($value);
if ($type === 'array') {
// Zend converts non-zero-indexed arrays to structs
if (array_keys($value) !== range(0, count($value) - 1) && array_keys($value) == range(1, count($value))) {
$value = array_values($value);
}
foreach ($value as &$child) {
$toBeVisited[] =& $child;
}
} elseif ($type === 'object') {
if ($value instanceof \DateTime) {
$value = \Zend_XmlRpc_Value::getXmlRpcValue($value->format('Ymd\\TH:i:s'), \Zend_XmlRpc_Value::XMLRPC_TYPE_DATETIME);
} elseif ($value instanceof Base64) {
$value = \Zend_XmlRpc_Value::getXmlRpcValue($value->getDecoded(), \Zend_XmlRpc_Value::XMLRPC_TYPE_BASE64);
} else {
$value = get_object_vars($value);
}
} elseif ($type === 'resource') {
throw new InvalidTypeException($value);
}
array_shift($toBeVisited);
}
$request = new \Zend_XmlRpc_Request($method, $params);
try {
return $request->saveXml();
} catch (\Exception $e) {
throw new SerializerException($e->getMessage(), $e->getCode(), $e);
}
}
示例2: testSaveXML
/**
* testSaveXML() test
*/
public function testSaveXML()
{
$argv = array('string', true);
$this->_request->setMethod('do.Something');
$this->_request->setParams($argv);
$xml = $this->_request->saveXml();
$this->_testXmlRequest($xml, $argv);
}
示例3: microtime
$serializer = null;
$start = microtime(true);
for ($a = 0; $a < $limit; ++$a) {
$request = new Zend\XmlRpc\Request();
$request->setMethod('test');
$request->setParams($args);
$r = $request->saveXml();
}
$end = microtime(true);
printf("Zend\\XmlRpc\\Request (ZF2): %s sec for %d passes\n", $end - $start, $limit);
$start = microtime(true);
for ($a = 0; $a < $limit; ++$a) {
$request = new Zend_XmlRpc_Request();
$request->setMethod('test');
$request->setParams($args);
$r = $request->saveXml();
}
$end = microtime(true);
printf("Zend_XmlRpc_Request (ZF1): %s sec for %d passes\n", $end - $start, $limit);
$start = microtime(true);
for ($a = 0; $a < $limit; ++$a) {
$serializer = new fXmlRpc\Serializer\XmlWriterSerializer();
$r = $serializer->serialize('test', $args);
}
$end = microtime(true);
printf("fXmlRpc\\Serializer\\XmlWriterSerializer: %s sec for %d passes\n", $end - $start, $limit);
$start = microtime(true);
for ($a = 0; $a < $limit; ++$a) {
$serializer = new fXmlRpc\Serializer\NativeSerializer();
$r = $serializer->serialize('test', $args);
}