一、
return array([
'price' => $price,'discount' => $discount
]);
这样return出去的是二维数组
array(1) { [0]=> array(2) { ["price"]=> float(26) ["discount"]=> int(89) } }
二、
return ([
'price' => $price,
'discount' => $discount
]);
这样return出去的是一维数组array(2) { ["price"]=> float(26) ["discount"]=> int(89) }
欢迎关注微信订阅号:phpstory