$m = M('service_loginlog');
$res =$m->where('card_id='.$_SESSION['card_id'])->order('time desc')->select();
foreach($res as $k=>$v){
if($k>20){
$m->where('id='.$v['id'])->delete();
}
}
$m = M('service_loginlog');
$res =$m->where('card_id='.$_SESSION['card_id'])->order('time desc')->select();
foreach($res as $k=>$v){
if($k>20){
$m->where('id='.$v['id'])->delete();
}
}
本文标题:php查询超出20记录自动删除 --- 2018-11-26
本文链接:https://www.haomeiwen.com/subject/zkuvqqtx.html
网友评论