0514-86177077
9:00-17:00(工作日)
方法一:
return DB::table('game_matchperiod')->select('starttime')->where('Type',$type)->get() ->map(function ($value) {return (array)$value;})->toArray();
方法二:
public function objToArr($object) { //先編碼成json字符串,再解碼成數(shù)組 return json_decode(json_encode($object), true); }
以上這篇laravel框架查詢數(shù)據(jù)集轉為數(shù)組的兩種方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
標簽:山南 南寧 三亞 鷹潭 烏魯木齊 赤峰 濟寧 迪慶
上一篇:thinkphp5框架實現(xiàn)數(shù)據(jù)庫讀取的數(shù)據(jù)轉換成json格式示例
下一篇:thinkphp 5框架實現(xiàn)登陸,登出及session登陸狀態(tài)檢測功能示例
Copyright ? 1999-2012 誠信 合法 規(guī)范的巨人網(wǎng)絡通訊始建于2005年
蘇ICP備15040257號-8