本文整理汇总了PHP中XmlWriter::flush方法的典型用法代码示例。如果您正苦于以下问题:PHP XmlWriter::flush方法的具体用法?PHP XmlWriter::flush怎么用?PHP XmlWriter::flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlWriter
的用法示例。
在下文中一共展示了XmlWriter::flush方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute($input)
{
$this->isRoot = true;
$this->writer = new XMLWriter();
$this->writer->openMemory();
$this->writer->startDocument('1.0', 'UTF-8');
$this->writer->setIndent(true);
$this->run($input);
return $this->writer->flush();
}
示例2: writeObject
/**
* writeObject will write the RSS representation of Object.
*
* @param object $object
*
* @throws \LogicException if no writer can handle $object or if $object is not an object
*/
public function writeObject($object)
{
if (!is_object($object)) {
throw new \LogicException(sprintf('%s::%s expects an object. %s given.', __CLASS_, __METHOD__, gettype($object)));
}
$fqcn = get_class($object);
if (!isset($this->writers[$fqcn])) {
throw new \LogicException(sprintf('No writer found for class %s', $fqcn));
}
call_user_func($this->writers[$fqcn], $this, $object);
if ($this->flushEarly) {
$this->xmlWriter->flush();
}
}
示例3: flush
public function flush()
{
$this->cursor->endDocument();
return $this->cursor->flush();
}
示例4: flush
public function flush()
{
$this->writer->flush();
}
示例5: XmlWriter
<?php
$xml = new XmlWriter();
$xml->openMemory();
$xml->setIndent(true);
$xml->startDocument();
$xml->startElement('test');
$xml->writeElement('foo', null);
$xml->writeElement('foo2', "");
$xml->writeElement('foo3');
$xml->startElement('bar');
$xml->endElement('bar');
$xml->endElement();
$xml->endElement();
print $xml->flush(true);
print "\n";
$xw = new XMLWriter();
$xw->openMemory();
$xw->setIndent(true);
$xw->startDocument();
$xw->startElementNS('test', 'test', 'urn:x-test:');
$xw->writeElementNS('test', 'foo', null, '');
$xw->writeElementNS(null, 'bar', 'urn:x-test:', '');
$xw->writeElementNS(null, 'bar', 'urn:x-test:', NULL);
$xw->writeElementNS(null, 'bar', 'urn:x-test:');
$xw->writeElementNS(null, 'bar', '', '');
$xw->endElement();
$xw->endDocument();
print $xw->flush(true);
示例6: flush
/**
* The parameter is merely to comply with PHP's notion that I am
* overriding the parent's flush, so I should provide the same
* signature. Nor am I not, but, even if I was, PHP should allow
* different signatures, i.e., enable both methods to be called...
*
* @see XMLWriter::flush()
*/
public function flush($empty = true)
{
parent::endDocument();
return parent::flush($empty);
}