我想删除从datetime获得的空间。由于此JSON格式无效。 以下是我的JSON响应:
{
"txId": "226334",
"createdAt":"2019-06-20
18: 33: 51","details":"Transfered
out","account_name_2":"","currency":"myr","amount":"-44.00","balance":"44,
272.80"}
下面是我的代码
$data['transactions'] = [];
foreach ($transactions as $tx) {
$data['transactions'][] = array(
'txId' => $tx['id'],
'createdAt' => trim($tx['created_at']),
'details' => str_replace(" "," ",$this->lang->line($tx['description'])),
'account_name_2' => isset($merchants[$tx['account_name_2']]) ? $merchants[$tx['account_name_2']] : $tx['account_name_2'],
'currency' => $currency,
'amount' => $tx['amount'] > 0 ? '+' . number_format($tx['amount'] * $forex['buy_in'], 2) : number_format($tx['amount'] * $forex['buy_in'], 2),
'balance' => number_format($total * $forex['buy_in'], 2)
);
$total -= number_format($tx['amount'] * $forex['buy_in'], 2);
}
$this->respSuccess($data);
答案 0 :(得分:0)