當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Writer::endDocument方法代碼示例

本文整理匯總了PHP中Sabre\Xml\Writer::endDocument方法的典型用法代碼示例。如果您正苦於以下問題:PHP Writer::endDocument方法的具體用法?PHP Writer::endDocument怎麽用?PHP Writer::endDocument使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sabre\Xml\Writer的用法示例。


在下文中一共展示了Writer::endDocument方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: exportXml

 public function exportXml()
 {
     $writer = new Writer();
     $writer->openMemory();
     $writer->startDocument();
     $writer->startElement('Document');
     $writer->writeAttribute('xmlns', 'urn:iso:std:iso:20022:tech:xsd:pain.001.001.03');
     $writer->setIndent(true);
     // header
     $writer->startElement('CstmrCdtTrfInitn');
     $writer->startElement('GrpHdr');
     $writer->writeElement('MsgId', $this->getMessageId());
     $writer->writeElement('CreDtTm', $this->getRequestDateTime());
     $writer->writeElement('NbOfTxs', $this->getPayaPaymentInfo()->getNumberOfPayments());
     $writer->writeElement('CtrlSum', $this->getPayaPaymentInfo()->getTotalTransactionsAmount());
     $writer->startElement('InitgPty');
     $writer->writeElement('Nm', $this->getPayaPaymentInfo()->getPayerName());
     $writer->endElement();
     $writer->endElement();
     // payment info
     $writer->startElement('PmtInf');
     $writer->writeElement('PmtInfId', $this->payaPaymentInfo->getPaymentInfoId());
     $writer->startElement('PmtMtd');
     $writer->writeAttribute('Ccy', 'IRR');
     $writer->write($this->payaPaymentInfo->getPaymentMethod());
     $writer->endElement();
     $writer->writeElement('NbOfTxs', $this->payaPaymentInfo->getNumberOfPayments());
     $writer->writeElement('CtrlSum', $this->payaPaymentInfo->getTotalTransactionsAmount());
     $writer->writeElement('ReqdExctnDt', $this->payaPaymentInfo->getRequestDate());
     $writer->startElement('Dbtr');
     $writer->writeElement('Nm', $this->payaPaymentInfo->getPayerName());
     $writer->endElement();
     $writer->startElement('DbtrAcct');
     $writer->startElement('Id');
     $writer->writeElement('IBAN', $this->payaPaymentInfo->getPayerIban());
     $writer->endElement();
     $writer->endElement();
     $writer->startElement('DbtrAgt');
     $writer->startElement('FinInstnId');
     $writer->writeElement('BIC', 'BMJIIRTHXXX');
     $writer->endElement();
     $writer->endElement();
     /** @var PayaPayment $payment */
     foreach ($this->payaPaymentInfo->getPayments() as $payment) {
         $writer->startElement('CdtTrfTxInf');
         $writer->startElement('PmtId');
         $writer->writeElement('InstrId', 'EMPTY');
         $writer->writeElement('EndToEndId', 'EMPTY');
         $writer->endElement();
         $writer->startElement('Amt');
         $writer->startElement('InstdAmt');
         $writer->writeAttribute('Ccy', 'IRR');
         $writer->write($payment->getAmount());
         $writer->endElement();
         $writer->endElement();
         $writer->startElement('Cdtr');
         $writer->writeElement('Nm', $payment->getCreditorName());
         $writer->endElement();
         $writer->startElement('CdtrAcct');
         $writer->startElement('Id');
         $writer->writeElement('IBAN', $payment->getCreditorIban());
         $writer->endElement();
         $writer->endElement();
         $writer->endElement();
     }
     $writer->endElement();
     $writer->endElement();
     $writer->endElement();
     $writer->endDocument();
     return $writer->outputMemory();
 }
開發者ID:nikapps,項目名稱:iran-bank-batch-payment,代碼行數:71,代碼來源:PayaCollection.php


注:本文中的Sabre\Xml\Writer::endDocument方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。