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条就清除多余的呢?
先感谢解答..