很遗憾没有laravel中的 updateOrCreate 只能这样了 $rs = D("table"); if($rs->where(array("id"=>$id,"cid"=>$cid))->count