本文整理汇总了PHP中Zend_XmlRpc_Value::getGenerator方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_XmlRpc_Value::getGenerator方法的具体用法?PHP Zend_XmlRpc_Value::getGenerator怎么用?PHP Zend_XmlRpc_Value::getGenerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_XmlRpc_Value
的用法示例。
在下文中一共展示了Zend_XmlRpc_Value::getGenerator方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testChangingExceptionResetsGeneratorObject
public function testChangingExceptionResetsGeneratorObject()
{
$generator = Zend_XmlRpc_Value::getGenerator();
Zend_XmlRpc_Value::setEncoding('UTF-8');
$this->assertNotSame($generator, Zend_XmlRpc_Value::getGenerator());
$this->assertEquals($generator, Zend_XmlRpc_Value::getGenerator());
$generator = Zend_XmlRpc_Value::getGenerator();
Zend_XmlRpc_Value::setEncoding('ISO-8859-1');
$this->assertNotSame($generator, Zend_XmlRpc_Value::getGenerator());
$this->assertNotEquals($generator, Zend_XmlRpc_Value::getGenerator());
}
示例2: saveXml
/**
* Return response as XML
*
* @return string
*/
public function saveXml()
{
$value = $this->_getXmlRpcReturn();
$generator = Zend_XmlRpc_Value::getGenerator();
$generator->openElement('methodResponse')->openElement('params')->openElement('param');
$value->generateXml();
$generator->closeElement('param')->closeElement('params')->closeElement('methodResponse');
return $generator->flush();
}
示例3: testGetSetEncoding
/**
* Test get/setEncoding()
*/
public function testGetSetEncoding()
{
$this->assertEquals('UTF-8', $this->_server->getEncoding());
$this->assertEquals('UTF-8', Zend_XmlRpc_Value::getGenerator()->getEncoding());
$this->assertSame($this->_server, $this->_server->setEncoding('ISO-8859-1'));
$this->assertEquals('ISO-8859-1', $this->_server->getEncoding());
$this->assertEquals('ISO-8859-1', Zend_XmlRpc_Value::getGenerator()->getEncoding());
}
示例4: saveXml
/**
* Create XML request
*
* @return string
*/
public function saveXml()
{
$args = $this->_getXmlRpcParams();
$method = $this->getMethod();
$generator = Zend_XmlRpc_Value::getGenerator();
$generator->openElement('methodCall')->openElement('methodName', $method)->closeElement('methodName');
if (is_array($args) && count($args)) {
$generator->openElement('params');
foreach ($args as $arg) {
$generator->openElement('param');
$arg->generateXml();
$generator->closeElement('param');
}
$generator->closeElement('params');
}
$generator->closeElement('methodCall');
return $generator->flush();
}
示例5: saveXml
/**
* Serialize fault to XML
*
* @return string
*/
public function saveXml()
{
// Create fault value
$faultStruct = array('faultCode' => $this->getCode(), 'faultString' => $this->getMessage());
$value = Zend_XmlRpc_Value::getXmlRpcValue($faultStruct);
$generator = Zend_XmlRpc_Value::getGenerator();
$generator->openElement('methodResponse')->openElement('fault');
$value->generateXml();
$generator->closeElement('fault')->closeElement('methodResponse');
return $generator->flush();
}