PHP获取某个时间的前N天

function get_days($num = 30, $time = '')
{
    $time = $time ? $time : time();
    $days = [];for ($i = $num; $i >= 1; $i--) {
        $days[] = date("Y-m-d", strtotime('-' . $i . 'day', $time));
    }
    return $days;
}



你可能感兴趣的:(PHP获取某个时间的前N天)