伙计们,这是完整的代码:
$response = $this->db->select('DATE(`created_at`) as `day`')->select('MIN(`paid_amount`) as `min_amount`')->select('MAX(`paid_amount`) as `max_amount`')->get('orders');
$nation = array();
foreach ($response->result() as $row)
{
print_r((array)$row);
array_push($nation, (array)$row);
}
我得到了 print_r 的输出,如下所示:
Array
(
[day] => 2013-03-24
[min_amount] => 2.00
[max_amount] => 2.00
[avg_amount] => 2.000000
[total_revenue] => 2.00
[total_orders] => 1
[total_subscriptions] => 0
[total_refunds] => 0
[refunded_amount] => 1.00
)
我使用了下面的forloop,但它没有工作。如何遍历这个数组:
foreach($nation as $key=>$value)
{
echo $key;
}