TP多条件查询实例

where条件查询,时间范围查询this

$condition = [
    ['member_id', '=', $member_id]
];
if($type) {
    $condition[] = ['type', '=', $type];
}
if ($start_time) {
    $condition[] = ['active_time', '>=', $start_time];
}
if ($end_time) {
    $condition[] = ['active_time', '<', $end_time];
}
$list = $this->where($condition)->field($field)->select();
相关文章
相关标签/搜索