我正在使用它来创建一个数组:
foreach($results as $tire){
$group_price[] = array($tire->group, $tire->price);
}
我的结果是:
Array (
[0] => Array (
[0] => MAXAT
[1] => 118.91
)
[1] => Array (
[0] => FZSUV
[1] => 137.81
)
[2] => Array (
[0] => MAXAT
[1] => 153.79
)
)
我希望我的结果是:
Array (
[0] => Array (
[group] => MAXAT
[price] => 118.91
)
[1] => Array (
[group] => FZSUV
[price] => 137.81
)
[2] => Array (
[group] => MAXAT
[price] => 153.79
)
)
我只是不确定如何改变我的 foreach 以改变输出。