我想使用Coinpayments API创建大规模提款。 它应该看起来像这样
$req = array(
'wd[wd1][amount]' => 1.00, //amount will be fetched from database
'wd[wd1][address]' => '1BitcoinAddress', //btc address from database
'wd[wd1][currency]' => 'BTC',
'wd[wd2][amount]' => 0.0001,
'wd[wd2][address]' => '1BitcoinAddress',
'wd[wd2][currency]' => 'BTC',
'wd[wd3][amount]' => 0.0001,
'wd[wd3][address]' => '1BitcoinAddress',
'wd[wd3][currency]' => 'BTC',
//[wd4] for the fifth withdrawal and so on
);
所以我想用while循环将所有提款填充到一个数组中 提前致谢 我就是这样做的
$q = "SELECT amount, ecurrency_address, 1week FROM Tablename WHERE status = 'Processed'";
$r = mysqli_query($mysqli, $q) or die ("Error");
$i = 0;
$j = 0;
while($f = mysqli_fetch_assoc($r)){
++$j;
if($j === 2){
$j = 1;
$i = ++$i;
}
$y['wd'.$i]['amount']=$f['amount'];
$y['wd'.$i]['ecurrency_address']=$f['ecurrency_address'];
$y['wd'.$i]['currency']='BTC';
}
echo '<pre>';
print_r($y);
更新
我已经能够得到这个数组
Array
(
[wd1] => Array
(
[amount] => 0.05
[ecurrency_address] => 1BitcoinAddress
[currency] => BTC
)
[wd2] => Array
(
[amount] => 10
[ecurrency_address] => 1BitcoinAddress
[currency] => BTC
)
[wd3] => Array
(
[amount] => 96
[ecurrency_address] => 1BitcoinAddress
[currency] => BTC
)
)
堆叠在实现"WD[WD1][金额]">
要实现所需的数组,请替换以下部分:
$y['wd'.$i]['amount']=$f['amount'];
$y['wd'.$i]['ecurrency_address']=$f['ecurrency_address'];
$y['wd'.$i]['currency']='BTC';
有了这个:
$y['wd[wd'.$i.'][amount]'] = $f['amount'];
$y['wd[wd'.$i.'][ecurrency_address]'] = $f['ecurrency_address'];
$y['wd[wd'.$i.'][currency]'] = $f['BTC'];