十五
- 十五 赞了回复
$datas = ArrayHelper::map($dataProvider, 'id', function ($dataProvider) { return [ 'BaiduLat' => $dataProvider->BaiduLat, 'BaiduLon' => $dataProvider->BaiduLon, ]; }, 'id');
打印出的结果如下
[ '1'=>[ 'BaiduLat' => 31.262788, 'BaiduLon' => 121.630306, ], '2'=>[ 'BaiduLat' => ..., 'BaiduLon' => ..., ], ]
这样是不是方便使用了。
手打的代码,如果有误,可以联系我。