Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 获取mysql查询以使用具有名称空间的类_Php_Mysql_Xml - Fatal编程技术网

Php 获取mysql查询以使用具有名称空间的类

Php 获取mysql查询以使用具有名称空间的类,php,mysql,xml,Php,Mysql,Xml,我正在为SEPA直接借记创建一个XML文件 我正在使用并使示例正常工作,但我似乎无法在MYSQL中使用它,而 我使用composer安装了throught composer.json 工作示例: <?php require 'vendor/autoload.php'; //When you start to generate a SEPA Xml File, need to choose PAIN $directDebitTransaction = \SEPA\XMLGenerator:

我正在为SEPA直接借记创建一个XML文件

我正在使用并使示例正常工作,但我似乎无法在MYSQL中使用它,而

我使用composer安装了throught composer.json

工作示例:

<?php
require 'vendor/autoload.php';

//When you start to generate a SEPA Xml File, need to choose PAIN
$directDebitTransaction = \SEPA\XMLGenerator::PAIN_008_001_02;// For Direct Debit transactions is By Defaut

$sepa = SEPA\Factory\XMLGeneratorFactory::createXmlGeneratorObject($directDebitTransaction)->addXmlMessage(
    SEPA\Factory\XMLGeneratorFactory::createXMLMessage()
        ->setMessageGroupHeader(
        SEPA\Factory\XMLGeneratorFactory::createXMLGroupHeader()
            ->setMessageIdentification(1)
            ->setInitiatingPartyName('Amazing SRL ???? ыаывпавпва '))
            ->addMessagePaymentInfo(
        SEPA\Factory\XMLGeneratorFactory::createXMLPaymentInfo()
            ->setPaymentInformationIdentification(6222)
            ->setSequenceType('RCUR')
            ->setCreditorAccountIBAN('MD24 AG00 0225 1000 1310 4168')
            ->setCreditorAccountBIC('AABAFI42')
            ->setCreditorName('Amazing SRL')
            ->setCreditorSchemeIdentification('FR07ZZZ519993')
            ->setRequestedCollectionDate('2013-08-06')
            ->setAggregatePerMandate(true) //Default Transaction aggregation option = true
/* TRANSACCION - 1 */
            ->addDirectDebitTransaction( //First transaction
            SEPA\Factory\XmlGeneratorFactory::createXMLDirectDebitTransaction()
                ->setInstructionIdentification(3)
                ->setEndToEndIdentification(3)
                ->setInstructedAmount(100.5)
                ->setDebtorName('Roy SRL')
                ->setDebitIBAN('FR14 2004 1010 0505 0001 3M02 606')
                ->setDebitBIC('AABAFI22') //Optional
                ->setMandateIdentification('SDD000000016PFX0713') //unique Identifier
                ->setDateOfSignature('2013-08-03')
                ->setCurrency('EUR')
                ->setDirectDebitInvoice(122)
           )
/* TRANSACCION - 2 */
// ...
/* TRANSACCION - 3 */
// ...
/* TRANSACCION - N */
// ...
    )
);

/* this is the part I need to use to REPLACE the transactions parts above */
$mysqli = new mysqli("localhost","root","","test");
if ($result = $mysqli->query("SELECT * FROM test"))
{
    while ($data = $result->fetch_object())
    {
        /*
        * here we get the data needed for the addDirectDebitTransaction()
        */
    }
}
$result->free();
$mysqli->close();

/* save XML */
$sepa->view()->save(realpath(__DIR__) .'/test.xml');

/* EOF */

您不使用XML,而是使用SEPA。XML仅间接用作序列化格式

您可以调用生成SEPA消息的特定PHP库的方法


也就是说,首先生成支付信息并将其存储到变量中。使用循环添加交易、生成消息和附加付款信息。

我知道这个问题已经三年了,但也许我们可以帮助某人,发现这一点解释如下:

//创建SEPA文件

\SEPA\Factory\XMLGeneratorFactory::createXmlGeneratorObject(\SEPA\XMLGenerator::PAIN_008_001_02) ->addXmlMessage( SEPA\Factory\XMLGeneratorFactory::createXMLMessage()->setMessageGroupHeader(


这就是我想要的,但如何调用来添加事务?这是我从上面的代码中不知道的。我将内容保存在var$sepa中,但在de while循环中…我如何添加数据?我想知道如何做到这一点:$sepa->[这里是什么?]->addDirectDebitTransaction($object\u从\u查询内部生成的\u)
SEPA\Factory\XMLGeneratorFactory::createXMLPaymentInfo()
创建付款信息。这是由
SEPA\Factory\XMLGeneratorFactory::createXMLMessage()创建的SEPA消息的
->addMessagePaymentInfo()
的参数
。拆分嵌套函数调用!拆分嵌套函数调用!…你认为我为什么在这里?我不知道怎么做。。。

$paymentInfo = SEPA\Factory\XMLGeneratorFactory::createXMLPaymentInfo();

$transactions = array(1, 2, 3, 4, 5);
$a = 0;
//add payment info transactions
foreach($transactions as $t)
{
    $paymentInfo->addDirectDebitTransaction(
        SEPA\Factory\XmlGeneratorFactory::createXMLDirectDebitTransaction()
            ->setInstructionIdentification(++$a)
            ->setEndToEndIdentification(++$a)
            ->setInstructedAmount(100.5)
            ->setDebtorName('DVORAK')
            ->setDebitIBAN('FR14 2004 1010 0505 0001 3M02 606')
            ->setDebitBIC('AABAFI22')
            ->setMandateIdentification('SDD000000016PFX071'.$a)
            ->setDateOfSignature('2013-08-03')
            ->setDirectDebitInvoice(++$a));

}

//set The payment info
$paymentInfo->setPaymentInformationIdentification(6222)
    ->setSequenceType('RCUR')
    ->setCreditorAccountIBAN('MD24 AG00 0225 1000 1310 4168')
    ->setCreditorAccountBIC('AABAFI42')->setCreditorName('Amazing SRL')
    ->setCreditorSchemeIdentification('FR07ZZZ519993')
    ->setRequestedCollectionDate('2013-08-06');
      SEPA\Factory\XMLGeneratorFactory::createXMLGroupHeader()
          ->setMessageIdentification($identificacionFichero = 1)
          ->setInitiatingPartyName($datos['nombreCliente'] = 'test')
          ->setPrivateIdentification($identificador=123)
  )->addMessagePaymentInfo($paymentInfo)

)->save($fileExist = realpath(__DIR__) . '/xml_files/sepa_demo.xml');