方法一: return DB::table('game_matchperiod')->select('starttime')->where('Type',$type)->get() ->map(function ($va
方法一:
.return DB::table('game_matchperiod')->select('starttime')->where('Type',$type)->get() ->map(function ($value) {return (array)$value;})->toArray();
.方法二:
.public function objToArr($object) { //先编码成json字符串,再解码成数组 return json_decode(json_encode($object), true);}
.以上这篇laravel框架查询数据集转为数组的两种方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持..。