thinkPHP 分頁後如何處理資料?
$result = Db::table($table)->alias('cx')
->leftJoin('student s', 's.service_status = 1')
->leftJoin('subject sub', 'cx.subject_id = sub.id')
->where($where)
->field([
'cx.subject_id',
'sub.name as subject_name',
's.username',
's.phone'
])
->paginate($limit)->each(function($item){
$item['smartyPro'] = $item['smartyPro'] . '%';
$item['新欄位'] = '100%';
return $item;
});
手冊地址:https://www.kancloud.cn/manual/thinkphp5_1/354120
歡迎關注公-眾-號【TaonyDaily】、留言、評論,一起學習。
Don’t reinvent the wheel, library code is there to help.
文章來源:劉俊濤的部落格
若有幫助到您,歡迎點贊、轉發、支援,您的支援是對我堅持最好的肯定(_)