if($logNums >= 20) {
$logList = $tableLog->limit(20)->order("id", "asc")->select() ;
foreach($logList as $k => $v){
#$condition[] = $v['id'];
}
$tableLog->where('id', 'in', $logList)->limit(20)->order("id", "asc")->delete();
}
請教大佬關於thinkphp操作資料庫的問題,如何保留最新的20條,大於20條就清除多餘的呢?
先感謝解答..