1
$array = array(
    $this->_order->revenue_seller($value,$from,$to),
    $this->_order->refund_seller($value,$from,$to),
    $this->_order->customers_seller($value,$from,$to),
    $this->_order->sales_seller($value,$from,$to)
);
$this->response($array,200);

我希望将数据显示为单个数组,但正如我们所见,输出开始显示为数组数组:

[
    [
        {
            "min_amount":"2.00",
            "max_amount":"2.00",
            "avg_amount":"2.000000",
            "total_revenue":"2.00"
        }
    ],
    [
        {
            "total_refund_amount":"1.00"
        }
    ],
    [
        {
            "created_at":"2013-03-24 15:04:35"
        }
    ],
    [
        {
            "quantity":"1"
        }
    ]
]

如何使数据显示为一个数组?

像这样:

[
{
"day":"2013-03-19",
"min_amount":"0.00",
"max_amount":"0.00",
"avg_amount":"0.000000",
"total_revenue":"0.00",
"quantity" : "1",
"total_refunded_amount":null,
"created_at":"2013-03-24 15:04:35"   
}]
4

1 回答 1

4

如果您通过所有四个函数获得数组返回而不是使用array_merge作为,

$array = array_merge($this->_order->revenue_seller($value,$from,$to),
                     $this->_order-refund_seller($value,$from,$to),
                     $this->_order->customers_seller($value,$from,$to),
                     $this-_order->sales_seller($value,$from,$to));
$this->response($array,200);

演示。

于 2013-06-12T05:41:52.920 回答